next_schedule_time bug fix