minor fixes and unit test fixes