Fix testes and code typo

Big sorry for this new pull request. 
But i've fixed a typo in my last commit which caused the tests to pass.