added automatic reconnection after loss connection