Added reconnect if connection fails