fixed union() accepting 2d and 3d