Fixed bugs in gen_schedule