Fixed "disconnect" handling