Study: Last-minute drugs less safe