Correctly implement compare contract #3185