Fix z index sorting