modify image upload logic