Fix reconnect logic