Fix reconnect logic with websocket