Fix unit tests

And coverage and two code branches