Merge r52048,r52085,r52180-52181,r52239 from beta.
Remaing revisions for 1.39: r51130,r51725,r52086-52161,r52240.