1.6 for 1.7

Note I had to add an extra commit which we should probably backport to 1.6.