added wait_to_ready() in the right file, added protection in timer_sleep()