Misc cleanup

Some miscellaneous fixes.