dim2  legend_sort fix