fixing js for image uploads