Fix a bug of scheduler