Fix some upload bugs