fixed a bug in union()