Misc fixes

These are several fixes and additions that are coming from #479. They are standalone, so can be merged separately.