improve error handling for failed URLs