Fixed a bug when websocket wasn't nil before attempting a new connection