more unit tests and a small fix