Fix problem with disconnecting from server without notifying listeners