Fixed upload script memory bug