fixing unit tests and functional tests