Fix the way we check for unreleased pid files

Rewrote in a non-retarded way