a few bug fixes to image util