Finish unit tests and fix last errors