unit tests. some fixes