fixed compution of spacing is z direction