cherry-picked bbb2c1e