Fix bugs in streaming upload