added some error checking in syscall.c