fixed zindex sorting int func function