Fixes some code and test suite