fixed lexicographic comparison