fixed unit tests and some integration tests