Fixed unit tests and small issues