Bug fix in comparator