improved detection of errors on starting, and improved termination
fix in pilot