Upload script bug fix