Fixed 2d z-sorting.