Miscellaneous fixes and improvements.