Corrected detection of PID files