fixed a bug on the scheduler