Fixed functional and unit tests