Fix race condition with fetching images.