add error checking for ptrace