Fixed a bug of scheduler.