fix typo in sort function