cherry-pick from master.