fixed bug with scheduler