delivered the opinion of the court:
Defendant, Bobby D. Hare, entered a fully negotiated plea of guilty to residential burglary (720 ILCS 5/19 — 3(a) (West 1996)). The trial court accepted the plea and imposed the requested sentence but later vacated the judgment because the agreed sentence was less than the statutory minimum. Defendant moved for “specific performance” of the plea agreement. The trial court denied the motion. After a stipulated bench trial, defendant was convicted and sentenced as a Class X offender to 20 years’ imprisonment. The trial court denied defendant’s motion to reconsider his sentence, and he appeals. Defendant argues that the trial court erred in refusing to order “specific performance” of the original plea agreement. We affirm.
Defendant was charged with residential burglary, a Class 1 felony (720 ILCS 5/19 — 3(b) (West 1996)) normally carrying a sentence of 4 to 15 years’ imprisonment (see 730 ILCS 5/5 — 8—1(a)(4) (West 1996)). Defendant pleaded not guilty. At a bond hearing in March of 1997, the trial judge at the time recognized that, because defendant had at least two convictions of Class 2 or greater offenses, section 5 — 5—3(c)(8) of the Unified Code of Corrections (730 ILCS 5/5 — 5—3(c)(8) (West 1996)) would require that he be sentenced as though he had committed a Class X offense.
Eventually, defendant and the State reached a plea agreement. On July 2, 1998, defendant’s counsel told the court that defendant would “plead guilty to the offense of residential burglary in 97 — CF—249. He would be sentenced to a term in the Department of Corrections of *608four years receiving day for day good time consistent with the statute ***.” As part of the agreement, the State would dismiss two cases involving residential burglary charges and some pending traffic charges. In presenting a factual basis for the plea, the State observed that defendant had four prior convictions of residential burglary. Judge Peterson accepted defendant’s plea and sentenced him to four years’ imprisonment.
On July 8, 1998, Judge Peterson, on his own motion, vacated the judgment. His order stated that defendant’s guilty plea was void because, under section 5 — 5—3(c)(8) of the Unified Code of Corrections, defendant’s prior convictions of residential burglary required that he be sentenced as a Class X offender. Thus, as the minimum prison term for a Class X felony was six years’ imprisonment, defendant’s four-year sentence was illegal. See 730 ILCS 5/5 — 8— 1(a)(3) (West 1996). The order allowed defendant to choose among negotiating a new agreement that conformed to section 5 — 5—3(c)(8) of the Unified Code of Corrections, entering an open guilty plea, and withdrawing his guilty plea.
Defendant moved to reconsider the order, asserting that the four-year sentence was legal. The trial court denied this motion. Judge Peterson recused himself and Judge Morrison was assigned to this case. Defendant then filed his motion for “specific performance” of the plea agreement. The motion asserted that, in agreeing to recommend a four-year sentence, the State was fully aware of defendant’s prior convictions. Defendant’s motion reasoned that, as the State had agreed to recommend four years’ imprisonment, the minimum sentence for a Class 1 felony, the State was now obligated to offer defendant a six-year prison term, the minimum Class X sentence.
At the hearing on the motion, the State argued that “specific performance” of the agreement was impossible because Judge Peterson had declared the agreement void, placing the parties at “ground zero.” The State also claimed that, when it entered into the agreement, it was not aware of all of defendant’s prior offenses. Judge Morrison observed that Judge Peterson had already decided that the plea agreement was unenforceable because it called for an illegal sentence. The situation might have been different had the parties agreed to the “minimum sentence,” but in fact they had agreed to “four years.” Thus, the judge reasoned, although the parties may have assumed that their bargain was one for the applicable minimum sentence, they actually agreed to less than the statutory minimum, and Judge Peterson had correctly invalidated the plea agreement. The court entered a written order stating that the motion for “specific performance” was denied, Judge Peterson having already declared that the agreement was void.
*609We note that defendant’s brief asserts that Judge Morrison refused to rule on the motion for “specific performance” because he mistakenly believed that Judge Peterson had already ruled on it. However, the record shows that Judge Morrison refused to grant the motion for “specific performance” of the agreement because Judge Peterson had already ruled that the agreement itself was void. In any event, the correctness of the trial court’s ruling, and not the correctness of its reasoning, is the crucial issue on review. People v. Nash, 173 Ill. 2d 423, 432 (1996).
Eventually, the parties agreed to a stipulated bench trial and a sentencing cap of 25 years’ imprisonment. The trial court found defendant guilty and sentenced him to 20 years’ imprisonment. Defendant moved to reconsider the sentence, arguing in part that the original plea agreement entitled him to a six-year sentence. The trial court denied the motion, and defendant timely appealed.
On appeal, defendant again argues that the trial court erred in denying his motion for “specific performance” of the plea agreement. Defendant reasons that the agreement demonstrates that the parties intended that the State would recommend the minimum sentence, even though both parties erroneously assumed that this minimum was four years’ imprisonment rather than six years’ imprisonment. Thus, defendant urges, although the trial court could not enforce an agreement for only four years’ imprisonment, it should not have allowed the State to escape its contractual obligation to recommend the minimum sentence. For the reasons that follow, we disagree.
Plea agreements are governed to some extent by principles of contract law, subject to considerations of constitutional due process. People v. Evans, 174 Ill. 2d 320, 326-27 (1996). The parties could not bind the court to impose a sentence that was unauthorized by law See People v. Wilson, 181 Ill. 2d 409, 412-13 (1998); People v. Williams, 179 Ill. 2d 331, 333 (1997). Thus, as defendant admits, the court correctly vacated the original sentence. See People v. Wade, 116 Ill. 2d 1, 5-7 (1987). However, defendant maintains that the trial court erred in invalidating the entire plea agreement and should have held the State to its promise to recommend the minimum sentence.
We cannot accept defendant’s argument that the invalid plea agreement survived in part. We believe that, because the plea agreement was fatally defective, it did not bind the State. In construing the parties’ oral contract, the trial court specifically found that defendant and the State did not agree to the minimum authorized sentence, whatever that might be. Rather, the court found, the State agreed to recommend a sentence of four years’ imprisonment. This finding is not against the weight of the evidence, as the record of the guilty plea *610hearing bears it out. Because adhering to the parties’ contract would have violated the sentencing statute, the trial court could not hold defendant to his negotiated plea. However, it is equally true that the court could not require the State to perform according to an agreement that was void or according to one it did not make.
Although no Illinois case is precisely on point, language in Wade appears to control. There, the trial court vacated a negotiated sentence of probation because it was less than the statutory minimum. Later, the defendant was tried, convicted, and sentenced. Before the supreme court, the defendant argued in part that the trial judge who vacated defendant’s sentence should have recused himself at the defendant’s trial. The defendant relied on Supreme Court Rule 402(d)(2) (87 Ill. 2d R. 402(d)(2)), which requires a trial judge to recuse himself if, after the defendant entered a negotiated guilty plea, the judge withdrew his concurrence in the plea agreement and the defendant thereupon withdrew the plea.
In rejecting the defendant’s argument, the Wade court reasoned in part that the trial judge had not concurred in the terms of the plea agreement. The court explained:
“[T]he agreement was no longer effective after the probation term was vacated. [Citations.] The judge permitted Wade to plead not guilty after the probation term was vacated because it was clear there was no longer an agreement between the parties on the plea. With no plea agreement before the court, Rule 402(d)(2) did not apply ***.” Wade, 116 Ill. 2d at 9.
We read this language to mean that, when a trial court vacates an illegal sentence that it entered in accordance with a plea agreement, the illegality voids the entire agreement and not merely the sentence. This is consistent with the general rule of contract law that, without proper consideration from both parties, a purported contract is illusory and cannot be enforced in either law or equity. Moehling v. W.E. O’Neil Construction Co., 20 Ill. 2d 255, 265 (1960). An agreement is not enforceable in part if the unenforceable aspect is an essential part of the agreed exchange. Restatement (Second) of Contracts § 184(1) (1981). Here, the infirmity affected an essential part of the plea agreement — the sentencing concession the State provided as a major element of the consideration for defendant’s guilty plea. Thus, the “contract” did not bind either party and defendant could not enforce it.
In substance, defendant’s motion for “specific performance” more nearly resembled a motion to reform the plea agreement into one that would bind the State. However, we agree with those authorities that limit this remedy to where the mutual mistake is one of expression, *611 i.e., the parties’ written agreement does not accurately express their actual understanding. See United States v. Williams, 198 F.3d 988, 994 (7th Cir. 1999); United States v. Atkinson, 979 F.2d 1219, 1222-23 (7th Cir. 1992); United States v. Kuhl, 816 F. Supp. 623, 628-29 (S.D. Cal. 1993). If the contract accurately reflects the parties’ intent, but that intent resulted from a mutual mistake of fact, the proper remedy is rescission, not reformation. Williams, 198 F.3d at 994. We conclude that the trial court did not err in refusing to reform the agreement into one that the parties never reached.
The judgment of the circuit court of Winnebago County is affirmed.
Affirmed.
McLAREN and RAPP, JJ., concur.