BUGFIX: Fix error handling around socket disconnects