Fix unit tests/code