Fix error and better tests.