Misc fixes

Some miscellaneous fixes.