Fixed issues with schedule generation. No time to explain.