Fixed zindex calculations