Fix unit tests and CS