Cherry-pick for functional tests