minor bug and test fixes