some fixes to image functions