Fixed bug in image upload