correctly break ties in less and greater