Miscellaneous fixes and patches.