Various minor fixes and cleanups.