Fix bug in file upload process