fixed error with sleep()