fixed bug in scheduler