re-merged the changes from the unit-tests-branch&fixed the tests.