Crash fixes and reimplementation of disconnect messages.