fixed a bug in the scheduler when the program is restarted