Fix checking for duplicate annotations

Fix an issue where the sum of annotations by priority did not match the total number of annotations in case of duplicates in the original list of annotations.