Bug fixes to RUN_DIR creation and PID detection.