Fix bug in upload