Bugs fixed in upload files functions

Bugs fixed in upload files functions