fix z indices