fixed #6 add error handling for syscall