fixing connect and reconnect