Fixed upload bugs