fix the min/max comparisons in union()