Moved around the disconnection error handling code trying to fix server crash