Fixed comparator to satisfy the contract. In some edge cases this could
cause issues with Java7+ (TimSort).