Improved ptrace patch and added a appropriate test
Fixed missing include warnings in tests