Fix to generate schedule

Needs to be cleaned up later but this will work for now.