cherry-pick 83bac03 from 2.1.x branch