Fix unit tests and prevent warnings