- fix sort function