handle cleanup of images