removed some bugs in image upload.