more unit tests and another bug fix