added error handling for server unavailable