Fix a bug and a broken test.

Very embarrassing.