fix some bugs related to image