Fixed bug causing WebSocket not to reconnect