misc fixes and cleanup