fixing sort issue