modify m-sort