fixed the code for upload to work