cherry-pick d11ffb99517e55ca4db849c8b4bc01f5bf30275d from 1.9.x