Fixing invalidation of z indices.