Fixed a bug in the disconnection handler.