Shouldn't offset be equal to the total number of errors, considering you are deleting the annotation on successful upgrade?