Fixing sort issue