cherry-pick 2c8682a1b66a7b17aacf5d4b5886f287c808b770