bug and test fixes; 2 tests still failing