Misc. fixes and cleanups.