don't write image if already cached
also mark cached in prepare
Merge branch 'fix-command-binding' into use-caching
add tests
check for cached image in cache_image as well