fixed cleanup of images