Improved handling of bad pids.
Merge branch 'test' into dev