Enhanced tests for regeneration of images and a bugfix for images that were cached in multiple steps