slightly better error handling for network calls