Fix Scheduler and unit test