fix a few bugs in the image plugin