Fixed a bug in sched.c