added error handling for loss of dns resolution