fix some bugs in sched.c and fork.c