fixes for the z direction in 3d