fixing reconnection issues -

eg when the server is closed then reopened