Bug fix and test coverage improvements.