Cherry-pick fc97fc37de1a7adc22789ed04a2621f22f844b8d