Added error handling for network issues