more unit tests, fixes