fixed syscalls and exiting