Fix variant detection being sensitive to ordering of variants.