
591 N.W.2d 635 (1999)
STATE of Iowa, Appellee,
v.
Samuel DANN, Appellant.
No. 97-2108.
Supreme Court of Iowa.
March 24, 1999.
*636 Linda Del Gallo, State Appellate Defender, and Shellie L. Knipfer, Assistant State Appellate Defender, for appellant.
Thomas J. Miller, Attorney General, Sharon K. Hall, Assistant Attorney General, Lawrence H. Schultz, County Attorney, and Bruce A. Ingham, Assistant County Attorney, for appellee.
Considered by LARSON, P.J., and LAVORATO, SNELL, TERNUS, and CADY, JJ.
PER CURIAM.
Defendant, Samuel Dann, appeals the sentence entered upon his conviction of willful injury. See Iowa Code § 708.4 (1995). Dann objects to the five-year mandatory minimum portion of his sentence, which was imposed pursuant to Iowa Code section 902.7 for using a dangerous weapon while participating in a forcible felony. Dann contends the district court could not impose the mandatory minimum because the State failed to comply with Iowa Rule of Criminal Procedure 6(6) by not alleging in the trial information that he had used a dangerous weapon. We agree with Dann and vacate that portion of his sentence.

I. Background Facts and Proceedings.

Dann was charged by trial information with three counts of willful injury. The minutes of testimony attached to the trial information reflected that several witnesses would testify Dann stabbed three persons in the parking lot of a tavern in November of 1996. *637 The trial information itself, however, failed to allege that Dann had used a dangerous weapon or otherwise indicate how the willful injuries were inflicted. Following a jury trial, Dann was found guilty of one count of willful injury and two counts of assault with intent to inflict serious injury, which were lesser included offenses. The latter convictions are not involved on appeal.
At sentencing, the State raised the issue that Dann had used a dangerous weapon, i.e., a knife, and was subject to a mandatory five-year minimum term of incarceration as part of the sentence for the willful-injury conviction. See Iowa Code § 902.7. Dann's counsel objected, pointing out that no special interrogatory was given to the jury on the "dangerous weapon" issue. See Iowa R.Crim. P. 6(6), 21(2). The district court observed that under the instructions that were given, the jury could not have found Dann guilty of willful injury without finding beyond a reasonable doubt that he was in possession or control of a dangerous weapon. The court accordingly overruled the objection. Cf. State v. Teeters, 487 N.W.2d 346 (Iowa 1992) (addressing similar issue involving firearm usage). The court sentenced Dann to an indeterminate ten-year term of incarceration on the willful-injury conviction and imposed the five-year mandatory minimum term pursuant to section 902.7. This sentence was to run consecutively with concurrent, two-year sentences imposed for the other convictions.
Dann appeals, arguing that the court erred by imposing the five-year mandatory minimum term of incarceration on the willful injury conviction. Dann argues this was not an option because the State failed to allege in the trial information that he used a dangerous weapon. He maintains this is required by Iowa Rule of Criminal Procedure 6(6). We review for errors of law. See Iowa R.App. P. 4; State v. Rains, 574 N.W.2d 904, 909 (Iowa 1998).

II. Preservation of Error.

As a preliminary matter, we address the State's contention that Dann failed to preserve error on this issue. In district court, Dann objected to the imposition of the mandatory minimum, but only on grounds a special interrogatory had not been submitted to the jury. On appeal, Dann raises for the first time the issue concerning the omission in the trial information. Generally, matters not raised in the trial court will not be considered for the first time on appeal. State v. Luckett, 387 N.W.2d 298, 301 (Iowa 1986). Nonetheless, because Dann is challenging the legality of his sentence, error was not waived. See id.

III. Allegations of Use of a Dangerous Weapon.

The issue presented for our review concerns the proper interpretation of Iowa Rule of Criminal Procedure 6(6) in light of a recent statutory amendment to Iowa Code section 902.7. Rule 6(6) provides as follows:

Allegations of use of a firearm. If the offense charged is one for which the defendant, if convicted, will be subject by reason of the Code* to a minimum sentence because of use of a firearm, the allegation of such use, if any, shall be contained in the [trial information]. If use of a firearm is alleged as provided by this rule, and if the allegation is supported by the evidence, the court shall submit to the jury a special interrogatory concerning this matter, as provided in R. Cr. P. 21(2).
The asterisk specifically refers the reader to Iowa Code section 902.7. Until it was amended in 1995, section 902.7 provided as follows:
Minimum sentenceuse of a firearm.
At the trial of a person charged with participating in a forcible felony, if the trier of fact finds beyond a reasonable doubt that the person is guilty of a forcible felony and that the person represented that the person was in the immediate possession and control of a firearm, displayed a firearm in a threatening manner, or was armed with a firearm while participating in the forcible felony the convicted person shall serve a minimum of five years of the sentence imposed by law. A person sentenced pursuant to this section shall not be eligible for parole until the person has served the *638 minimum sentence of confinement imposed by this section.
Iowa Code § 902.7 (1995).
In State v. Luckett we vacated the mandatory minimum portion of a sentence imposed pursuant to section 902.7 because the State had failed to comply with rule 6(6) by not alleging in the trial information that the defendant had used a firearm. Luckett, 387 N.W.2d at 300-01. We found that compliance with this requirement was mandatory and that it was irrelevant the defendant actually knew the prosecution was contending he had used a firearm. We concluded: "If rule 6(6) is to have any meaning compliance must be mandatory. Having failed to comply with that rule the State is in no position to exact the mandatory sentence under the statute." Id. at 301.
The 1995 amendment to section 902.7 made one change to the statute: the word "firearm" used throughout the section was changed to "dangerous weapon." See 1995 Iowa Acts ch. 126, § 1. This statute was in effect at the time Dann committed the offenses in question. As a result, although Dann used a knife rather than a firearm, the mandatory minimum imposed by section 902.7 became applicable in his case. Dann does not argue otherwise, i.e., that the knife was not a dangerous weapon.
Dann does contend, however, relying on Luckett, that rule 6(6) requires the State to allege in the trial information that he used a dangerous weapon before the mandatory minimum can be imposed. In response, the State suggests that, under the plain language of the rule, it applies only in cases involving allegations of firearm usage. We agree with Dann.
Court rules are subject to rules of statutory construction. Luckett, 387 N.W.2d at 301; Committee on Prof'l Ethics & Conduct v. Shaffer, 230 N.W.2d 1, 2-3 (Iowa 1975). Principles of statutory construction should be applied when a statute is ambiguous. Farmers Coop. v. DeCoster, 528 N.W.2d 536, 537 (Iowa 1995). Ambiguity may arise in two ways: (1) from the meaning of particular words, or (2) from the general scope and meaning of a statute when all its provisions are examined. Carolan v. Hill, 553 N.W.2d 882, 887 (Iowa 1996). When more than one statute is pertinent to the inquiry, the court considers the statutes together in an attempt to harmonize them. American Asbestos Training Ctr., Ltd. v. Eastern Iowa Community College, 463 N.W.2d 56, 58 (Iowa 1990). The polestar of all statutory construction is the search for the true intention of the legislature. Iowa Nat'l Indus. Loan Co. v. Iowa State Dep't of Revenue, 224 N.W.2d 437, 439 (Iowa 1974).
In light of the recent amendment to Iowa Code section 902.7, we find that an ambiguity now exists in rule 6(6). While the rule continues to use the term "firearm," it does so in the context of referring to section 902.7. Section 902.7, however, no longer applies only to firearms, but to all "dangerous weapons." Consequently, when the two provisions are read together, a conflict becomes apparent.
One principle of statutory construction is that, in construing a statute, the court must be mindful of the state of the law when it was enacted and seek to harmonize the statute, if possible, with other statutes on the same subject matter. Doe v. Ray, 251 N.W.2d 496, 501 (Iowa 1977). Rule 6(6) was adopted in 1980. See 1980 Iowa Acts ch. 1208. Section 902.7 provided at that time that the mandatory minimum sentence applied only in cases in which a firearm was used. See Iowa Code § 902.7 (1979). Citing section 902.7, rule 6(6) likewise applied only to allegations of firearm usage.
In amending section 902.7, the legislature obviously intended to extend imposition of the mandatory minimum sentence to cases in which a defendant used a dangerous weapon other than a firearm. Unfortunately, rule 6(6) was not correspondingly amended to reflect this change. As a result, applying the rule as worded leads to an absurd result. A defendant who is alleged to have used a dangerous weapon other than a firearm is not entitled to the same notice afforded a defendant alleged to have used a firearm, even though both are now subject to the same statutory minimum, and the notice requirement of rule 6(6) serves an identical purpose in both cases. We believe it clear *639 that the legislature never intended this result; now that the scope of section 902.7 has expanded to include all dangerous weapons, we can conceive of no reason for limiting the scope of rule 6(6) to allegations of firearm usage.
Ordinarily, we may not add modifying words to a statute or change its terms. Schultze v. Landmark Hotel Corp., 463 N.W.2d 47, 49 (Iowa 1990). As an exception to this rule, however, we have recognized in limited circumstances the power to judicially construe legislative enactments in such a way as to correct inadvertent clerical errors or omissions that frustrate obvious legislative intent. Id.; see, e.g., Jones v. Iowa State Highway Comm'n, 207 N.W.2d 1, 3-4 (Iowa 1973) (finding clerical error in statute and judicially construing term "abuse or process" as "abuse of process"). Judicial alteration has also been allowed to avoid absurd, meaningless, irrational or unreasonable results. Schultze, 463 N.W.2d at 49; see also Jones, 207 N.W.2d at 3 (citing 2 Jabez Gridley Sutherland, Statutes & Statutory Construction §§ 4924, 4925, 4926 (3d ed.1943)). Recognizing that extreme caution is to be exercised in adopting such changes, see Jones, 207 N.W.2d at 3, we conclude this remedy is appropriate in the present case. The inconsistency in language between rule 6(6) and section 902.7 is due solely to the obvious omission of the appropriate change in rule 6(6) when section 902.7 was recently amended. We accordingly construe rule 6(6) as encompassing allegations of dangerous weapons usage; to do otherwise would frustrate obvious legislative intent.
The State, conceding the possibility we would take this course, alternatively suggests that it was enough the minutes of testimony indicated the use of a knife. We reject this argument for the reasons given in Luckett. The requirement that the State allege in the trial information the use of a "dangerous weapon," as we now construe rule 6(6) to provide, is mandatory, regardless of whether a defendant is otherwise aware the State is contending use of a dangerous weapon. The State's failure to comply with the notice requirement of rule 6(6) and include the appropriate allegation in the trial information precludes imposition of the mandatory minimum of section 902.7. See Luckett, 387 N.W.2d at 301.
As in Luckett, the judgment of Dann's guilt is affirmed, but the portion of the sentence that imposes the mandatory minimum is vacated. We remand the case to district court for resentencing in accordance with this opinion. The State need not produce Dann to be personally present at the correction of the sentence. See State v. Austin, 585 N.W.2d 241, 244 (Iowa 1998) (resentencing not "stage of the trial" under rule of criminal procedure 25(1)).
AFFIRMED IN PART; SENTENCE VACATED IN PART; AND REMANDED FOR RESENTENCING.
