fixed error in reconnect code