Fix upload bugs.