Use tuple-based comparison to avoid lexical-comparison shenangians

Per review of Bo Shi.