Fixing sorting of schedules