some fixes to image management