Cherry picked from a55606c061df2d94f16a92ab202576c9d3347fe6