rework pr_chooseBestVersion to fix logic flaw