cleanup and test fixes