Make the test actually test the right thing.

And make the code right.