Fix a bug in the new scheduler