Fixed bug with check if image is already in cache