Added error handling for URLs