Some bug fixes.  More test coverage.