Scheduler bug fixing