fixed pair.compareTo() issue
finished