cleanup and fix some test issues