Misc fixes

Fix a bunch of bugs that showed up in release testing.

cc @BooDoo for code review.