fix zindex computation