Fix bug with connectionLost not firing sometimes