Added error handling and logging for failures on downloading images.