distinct sort issue fix