Fixed WeightedComparator to work with Integer.MIN_VALUE