If the defendant was formerly acquitted on the ground of a variance between the indictment and the proof, or the indictment was dismissed, upon an objection to its form or substance, without a judgment of acquittal, it is not an acquittal of the same offense. If the defendant was acquitted on the merits, the defendant shall be deemed acquitted of the same offense, notwithstanding a defect in the form or substance of the indictment on which the defendant was acquitted.