Misc cleanups and fixes.