fix misc code for upload