only update z index of layers that actually exist!