bug fixes around upload