Improved pid status detection