fix retMaxsort bug