Cherry-picks from master to 3.6.x.