miscellaneous fixes

This is a shared branch containing improvements too small for individual PRs.

Feel free to push to it. It'll be merged before the end of the week.