Fixed tests failure
Added unit tests