Minor bug and test fixes.