Miscellaneous fixes

Minor fixes found through some testing.