Added error handling for when no images are found