problem with sort function