fixed bug for scheduling