The opinion of the court was delivered by: Justice Freeman
Defendant, Dennis Pullen, entered a negotiated plea in the circuit court of Bureau County. Claiming error in the sentencing, defendant filed an amended motion to withdraw the plea. The trial court denied defendant's motion. The appellate court reversed (304 Ill. App. 3d 294), and the State appeals to this court. The single issue is whether the trial court erred in denying defendant's motion to withdraw his negotiated plea. Resolution of this issue requires us to determine the maximum aggregate sentence when consecutive sentences are imposed on a defendant who has committed Class 1 or Class 2 felonies but is subject to sentencing "as a Class X offender" (730 ILCS 5/5-5-3(c)(8) (West 1994)) because of prior criminal convictions.
In June 1997 defendant entered a negotiated plea of guilty to five counts of burglary (720 ILCS 5/19-1 (West 1994)). *fn1 Although burglary is a Class 2 offense (see 720 ILCS 5/19-1(b) (West 1994)), defendant was required to be sentenced as a Class X offender (see 730 ILCS 5/5-5-3(c)(8) (West 1994)) because of his prior convictions, which included numerous previous felony convictions for burglary and convictions for felony theft, reckless homicide and driving while license revoked, second offense. By the terms of his plea, defendant was sentenced to 15 years' imprisonment on each of the five counts of burglary in this case. The sentences on counts I and II ran concurrently with each other, as did the sentences on counts III, IV, and V. However, the 15-year terms on counts I and II ran consecutively to the 15-year terms on counts III, IV, and V, resulting in an aggregate sentence of 30 years.
In July 1997 defendant moved to withdraw his guilty plea. With the assistance of counsel he later filed an amended motion. One of the contentions in the amended motion was that the 30-year sentence was void because it exceeded the maximum permissible term. The trial court denied the motion, and defendant appealed. The appellate court reversed the trial court's order. The court found that defendant was subject to a maximum sentence of 28 years, and accordingly the 30-year sentence was void. 304 Ill. App. 3d 294. We granted the State's petition for leave to appeal (see 177 Ill. 2d R. 315(a)), and now affirm the appellate court.
The issue in this case is whether defendant should have been allowed to withdraw his guilty plea. Leave to withdraw a plea of guilty is not granted as a matter of right, but as required to correct a manifest injustice under the facts involved. Generally, the decision whether to allow a defendant to withdraw a guilty plea under Rule 604(d) (145 Ill. 2d R. 604(d)) is left to the discretion of the trial court. In considering such a motion, the court shall evaluate whether the guilty plea was entered through a misapprehension of the facts or of the law, or if there is doubt of the guilt of the accused and the ends of justice would better be served by submitting the case to a trial. See People v. Hillenbrand, 121 Ill. 2d 537, 545 (1988). The court's decision is reviewed only for abuse of discretion. See People v. Gosier, 145 Ill. 2d 127, 143 (1991); People v. Kidd, 129 Ill. 2d 432, 447 (1989).
Defendant's primary contention is that he should have been allowed to withdraw his guilty plea because his sentence exceeded the maximum allowable sentence. If correct, this would constitute grounds for voiding defendant's guilty plea, because entering into a negotiated plea to serve a greater amount of time than that to which one could legally be sentenced would constitute a serious misapprehension of the law. Indeed, such a sentence would be void from inception. See People v. Arna, 168 Ill. 2d 107, 113 (1995) (sentence which does not conform to a statutory requirement is void).
The determination of the maximum sentence to which defendant could properly be subjected turns on our interpretation of several sections of the Unified Code of Corrections (Code) (730 ILCS 5/1-1-1 et seq. (West 1994)). As previously noted, defendant committed five counts of burglary, a Class 2 offense. See 720 ILCS 5/19-1(b) (West 1994). At the time of defendant's offenses, section 5-8-4(c)(2) of the Code provided in relevant part that "the aggregate of consecutive sentences shall not exceed the sum of the maximum terms authorized under Section 5-8-2 [of the Code] for the 2 most serious felonies involved." 730 ILCS 5/5-8-4(c)(2) (West 1994). There is no dispute that section 5-8-4(c)(2) applied to defendant. Section 5-8-2 of the Code, referenced in section 5-8-4(c)(2), allows a sentence of up to 60 years for a Class X felony, or up to 14 years for a Class 2 felony. 730 ILCS 5/5-8-2(a)(2), (a)(4) (West 1994). Another statutory provision relevant to this case is section 5-5-3(c)(8) of the Code, which provides that:
"When a defendant, over the age of 21 years, is convicted of a Class 1 or Class 2 felony, after having twice been convicted of any Class 2 or greater Class felonies in Illinois, and such charges are separately brought and tried and arise out of different series of acts, such defendant shall be sentenced as a Class X offender. This paragraph shall not apply unless (1) the first felony was committed after the effective date of this amendatory Act of 1977; and (2) the second felony was committed after conviction on the first; and (3) the third felony was committed after conviction on the second." 730 ILCS 5/5-5-3(c)(8) (West 1994).
There is no dispute that defendant's prior convictions required him to be sentenced as a Class X offender pursuant to section 5-5-3(c)(8).
Our appellate court has reached different conclusions as to the maximum aggregate of consecutive sentences when a defendant commits multiple Class 1 or Class 2 felonies but must be sentenced as a Class X offender because of prior felonies. The First District and, in the case under review, the Third District have held that the maximum aggregate sentence must be based on the sentences permissible for a Class 1 or Class 2 felony, not a Class X felony. People v. Ritchey, 286 Ill. App. 3d 848 (1997); 304 Ill. App. 3d 294. The Fourth District, however, has held that where consecutive sentences are mandatory, a defendant who is subject to sentencing as a Class X offender pursuant to section 5-5-3(c)(8) may properly be sentenced to consecutive Class X terms. People v. Stencil, 306 Ill. App. 3d 273 (1999). The Stencil court acknowledged that its decision "arguably conflicts with the words of the statute," but held that "defendant's consecutive sentences in the Class X sentencing range are the punishments he deserves." Stencil, 306 Ill. App. 3d at 279. See also People v. Perkins, 274 Ill. App. 3d 834, 836-37 (1995) (holding that because attempted murder is sentenced as a Class X felony, it is a Class X felony for purposes of section 5-8-4(a) of the Code (730 ILCS 5/5-8-4(a) (West 1994)) even though its offense level is unclassified and the Criminal Code defines unclassified offenses as Class 4 felonies).
In the exercise of statutory construction, our primary task is to ascertain and effectuate the intent of the legislature. In interpreting a statute we may consider the reason and necessity for the law, the evils it was intended to remedy, and its ultimate aims. Also, we must assume that the legislature did not intend an absurd or unjust result. However, our inquiry must always begin with the language of the statute, which is the surest and most reliable indicator of legislative intent. The language of the statute must be given its plain and ordinary meaning, and where the statutory language is clear and unambiguous, we have no occasion to resort to aids of construction. Nor, under the guise of statutory interpretation, can we "correct" an apparent legislative oversight by rewriting a statute in a manner inconsistent with its clear and unambiguous language. People v. Tucker, 167 Ill. 2d 431, 437 (1995); People v. Bole, 155 Ill. 2d 188, 195-99 (1993).
As previously noted, there is no dispute that defendant's maximum sentence was "the sum of the maximum terms authorized under Section 5-8-2 for the 2 most serious felonies involved." The question is whether the maximum permissible sentence was 120 years-the sum of the maximum permissible extended-term sentences for two Class X offenses (730 ILCS 5/5-8-2(a)(2) (West 1994))-or 28 years-the sum of the maximum permissible extended-term sentences for two Class 2 offenses (730 ILCS 5/5-8-2(a)(4) (West 1994)). However, the two most serious felonies involved in this case-indeed, the only felonies-are burglaries. Our criminal code explicitly defines burglary as a Class 2 felony. 720 ILCS 5/19-1(b) (West 1994). This ends the case. Since burglary is a Class 2 felony, the maximum sentence for burglary is 14 years. 730 ILCS 5/5-8-2(a)(4) (West 1994). Accordingly, the maximum aggregate sentence was 28 years. Since defendant was given an aggregate sentence in excess of 28 years, his sentence was void. Arna, 168 Ill. 2d at 113. ...