fix issue where an image viewer would not  be cleared