Fix exhausted coding bugs with STOPTIMEOUT and PID waiting.