Problems in the stop app code

There was some mangling (partly my own fault) in the indigo/hydro-devel code that caused me to issue the possibly spurious error #217.

Anyway, while digging, I noticed some potential threading problems in the code, so fixed them too.