Fix a bug in the comparison functions.

Apparently I didn't have good enough tests.