Start some backports

Backport (via cherry-pick) 4a16dc3, 87a55c3 (that is, #643) and 8b15807 from #665 (some of the first ones, randomly picked).

I did this in the weekend, and some patches would deserve a closer look, because they were basically "change all instances of X", and my backport is "change all instances of X from 7.1.x which are still in 7.0.x".