Some fixes

This is a bunch a bunch of loosely-coupled changes I did while working on 2.1.3 during the last year (there were a bunch of other things, but they look fixed in `develop`).

Some are quick-and-easy (4f8270fccc0b48b8ca17fcfa12e72ca2bae32e14, 0b85d16c7421001647a4171435a6eb1784b8a1f7), some are debatable (d5102e2513a4bbb9238e87b61fe518fbcbfc5b6d, 37b6fbe1781224769258c313b82410909ca0ead3).

Feel free to comment/cherry-pick/whatever if you find some sensible use to them ;-).