misc fixes and cleanups