Add some checks when fetching images