work on test coverage and some resulting bug fixes