better handling of cached image