manual cherry-pick of d13928c5 from master

d13928c502a76e8bececbb5befe38475c6c68f8f