update uses of sort, sortperm