fixed upload functionality