Fixed a bug with the connection handler.