
592 N.E.2d 342 (1992)
227 Ill. App.3d 795
169 Ill.Dec. 855
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Robert BROWN, Defendant-Appellant.
No. 1-89-2928.
Appellate Court of Illinois, First District, Fifth Division.
March 27, 1992.
Rita A. Fry, Chicago (Emily Eisner, of counsel), for defendant-appellant.
Jack O'Malley, Chicago (Renee Goldfarb, Theodore F. Burtzos, and Michelle I. Lavin, of counsel), for plaintiff-appellee.
Justice LORENZ delivered the opinion of the court:
After a bench trial, defendant, Robert Brown, was convicted of armed violence and possession of a controlled substance. (Ill.Rev.Stat.1987, ch. 38, par. 33A-2; ch. 56½, par. 1402(b).) Defendant argues on appeal that he was subject to double jeopardy when the trial judge initially granted a directed verdict in his favor on the armed violence count but then changed his ruling later in the same hearing. For the following reasons, we reverse defendant's conviction for armed violence.
*343 In count I of an information, defendant was charged with armed violence based on possession of a controlled substance with intent to deliver and in count II, he was charged with possession of a controlled substance with intent to deliver.
At trial, Officer Stephen Worsham testified that on June 26, 1988, while travelling in an unmarked squad car with his partner, he saw defendant walking down the street carrying a purse. When defendant saw Worsham looking at him, defendant dropped the purse and continued walking. Worsham recovered the purse, which contained a loaded gun and two spent shells, and arrested defendant. Worsham searched defendant and found a clear plastic bag holding 10 smaller clear plastic bags which were filled with white powder.
The parties stipulated that Linda Rayford, a chemist for the Chicago Crime Laboratory, would testify that the powder inside three of the bags weighed .52 of a gram and tested positive for cocaine. The State rested.
Defendant moved for a directed verdict and neither party presented an argument. In ruling on the motion, the judge stated:
"Based on a half a gram of cocaine, the Court is asked to find that the Defendant possessed with intent to deliver. No other evidence, either circumstantial or otherwise[,] other than [what] I have recited * * * aids the Court in reaching that conclusion [when] the evidence is viewed in the light most favorable to the State. Thus, the Court cannot find that the Defendant possessed cocaine with intent to deliver and as to that charge, the Defendant is found not guilty of the greater offense of possession with intent to deliver. Count I of the [information] charges the offense of armed violence in that the Defendant, while committing the offense of possession of a controlled substance with intent to deliver[,] was armed with a dangerous weapon. Having found the Defendant not guilty of the offense of possession with intent to deliver[,] it follows that he was not armed with a dangerous weapon while committing that offense, and the Defendant is found not guilty of Count 1." (Emphasis added.)
The State argued that even though the judge found defendant not guilty of possession with intent to deliver, the armed violence charge could be based on the lesser-included offense of possession. After some discussion, the judge agreed with the State and stated that the armed violence charge based on possession with intent to deliver carried with it the lesser-included offense of mere possession. Although the evidence at trial was insufficient to prove possession with intent to deliver, it was sufficient to prove possession of a controlled substance and armed violence based on possession. The judge denied defendant's motion for a directed verdict on armed violence and the trial continued.
Defendant testified that on June 26, 1988, he was walking down the street when he found a clear plastic bag containing smaller bags of cocaine. He put the bag in the waistband of his pants, intending to use the cocaine later, and he continued walking. One minute later, police officers stopped and searched him. They found the cocaine inside his pants and they found a black bag approximately 12 feet away from where he was standing. Defendant testified that he never had the black bag in his possession.
After closing arguments, the trial judge found defendant guilty of armed violence based on possession of a controlled substance and guilty of possession. At the sentencing hearing, the judge noted that because armed violence was a Class X felony, he was required to sentence defendant to a minimum of six years in prison. He also sentenced defendant to a concurrent term of one year in prison for possession of a controlled substance. Defendant now appeals.

OPINION
Defendant raises several arguments on appeal challenging his convictions but it is only necessary to consider whether the armed violence conviction violated principles of double jeopardy. Defendant argues his conviction violated double jeopardy because the trial judge initially granted his motion for a directed verdict on armed violence *344 but then denied the motion later in the same hearing.
Defendant did not raise this issue in the trial court. The failure to raise the defense of double jeopardy before judgment in the trial court waives the issue for review but it may be considered if it amounted to plain error. (People v. Mink (1990), 141 Ill.2d 163, 152 Ill.Dec. 293, 565 N.E.2d 975.) Plain error affecting substantial rights may be considered on review despite waiver when the evidence at trial was closely balanced or when the error was so fundamental and of such magnitude that the defendant was denied a fair trial. (Mink, 141 Ill.2d 163, 152 Ill.Dec. 293, 565 N.E.2d 975.) A conviction which violates double jeopardy is a substantial injustice and may be reviewed as plain error. (In re L.R. (1982), 106 Ill.App.3d 244, 62 Ill.Dec. 110, 435 N.E.2d 908.) In this case, the evidence at trial was not closely balanced, however, the alleged error was fundamental and may have denied defendant a fair trial. As a result, this court will consider the issue under the plain error doctrine.
No person shall be twice placed in jeopardy for the same offense. (U.S. Const., amend. V; Ill. Const. 1970, art. I, § 10.) A judgment of acquittal triggers double jeopardy protection when it "`represents a resolution, correct or not, of some or all of the factual elements of the offense charged.'" (People ex rel. Daley v. Crilly (1985), 108 Ill.2d 301, 311, 91 Ill.Dec. 601, 606, 483 N.E.2d 1236, 1241 (quoting United States v. Martin Linen Supply Co. (1977), 430 U.S. 564, 571, 97 S.Ct. 1349, 1355, 51 L.Ed.2d 642, 651).) The entry of a directed verdict in defendant's favor is an acquittal for double jeopardy purposes when there was insufficient evidence to establish as a matter of law some or all of the essential elements of the crime. (Crilly, 108 Ill.2d 301, 91 Ill.Dec. 601, 483 N.E.2d 1236.) It is irrelevant for the double jeopardy analysis whether the trial judge made a mistake of fact or law. People v. Poe (1984), 121 Ill.App.3d 457, 76 Ill.Dec. 752, 459 N.E.2d 667.
Defendant in this case relies primarily on People v. Stout (1982), 108 Ill.App.3d 96, 63 Ill.Dec. 810, 438 N.E.2d 952, to support his argument. (E.g., People v. Strong (1984), 129 Ill.App.3d 427, 84 Ill.Dec. 756, 472 N.E.2d 1152; Poe, 121 Ill.App.3d 457, 76 Ill.Dec. 752, 459 N.E.2d 667; L.R., 106 Ill. App.3d 244, 62 Ill.Dec. 110, 435 N.E.2d 908.) In Stout, the trial judge, in an oral ruling, entered a directed verdict in defendant's favor on one count. Later that same day, the State moved to reconsider. The judge granted the motion and stated that the directed verdict was withdrawn. The jury subsequently convicted defendant on that count and he appealed. The appellate court stated that the granting of a motion for directed verdict was an acquittal and that double jeopardy prevented the trial judge from vacating, reversing, or withdrawing the ruling. The State argued that the trial judge's oral ruling was insufficient to constitute a directed verdict. However, the court found that reducing the oral pronouncement of acquittal to a written judgment was a formality and the failure to do so did not impair the validity of the ruling. As a result, the court held that defendant was subjected to double jeopardy when the trial continued on that count after defendant was granted a directed verdict.
In Mink, the supreme court agreed with the holding in Stout and stated that "[r]econsideration and vacation of that order necessarily exposed the defendant to further proceedings devoted to resolving the factual elements of the offense, in violation of the double jeopardy clauses." Mink, 141 Ill.2d at 179, 152 Ill.Dec. at 300, 565 N.E.2d at 982.
In response to defendant's argument, the State in this case argues that defendant was never actually acquitted of armed violence relying on People v. Vilt (1983), 119 Ill.App.3d 832, 75 Ill.Dec. 346, 457 N.E.2d 136. In Vilt, the trial judge, in an oral ruling, allowed defendant's motion for a directed verdict on one count believing that the victim's testimony did not support it. When the State immediately questioned the ruling, the judge realized that he confused the testimony of two witnesses and that the victim's testimony actually supported that count. The judge then denied defendant's *345 motion for directed verdict. On appeal, the court found that double jeopardy principles were not violated because the trial judge immediately reversed himself and no passage of time intervened. The court distinguished Stout, which defendant here relies on, because it did not involve a situation where "the trial judge, virtually with the same breath, [indicated] that he would allow and then deny a motion for a directed verdict." (Vilt, 119 Ill.App.3d at 835, 75 Ill.Dec. at 348, 457 N.E.2d at 138.) The court found that defendant was never actually acquitted of the charge and the subsequent jury's verdict did not have the effect of double jeopardy.
The resolution of the present case is dependent on Stout rather than Vilt. Similar to Stout, the trial judge in this case granted defendant's motion for a directed verdict on the armed violence count and stated that he was found not guilty of that offense. The ruling was not equivocal. The appellate court in Stout found that such a ruling was an acquittal and that double jeopardy prevented the trial judge from reconsidering the ruling. In contrast, the trial judge in Vilt granted defendant's motion for a directed verdict and denied it a few moments later when the State pointed out a factual error. The appellate court held that under those circumstances, defendant was never actually acquitted of the offense. In this case, unlike Vilt, it cannot be held that defendant was not actually acquitted of armed violence. The trial judge found that the evidence was insufficient and stated that defendant was found not guilty of armed violence. This ruling resolved some of the factual elements of the offense. As a result, the ruling was an acquittal based on insufficient evidence which the trial judge could not reconsider. Defendant's subsequent conviction for armed violence violated principles of double jeopardy and must be reversed.
The State argues that double jeopardy should not be applied mechanically relying on People v. Rudi (1984), 103 Ill.2d 216, 82 Ill.Dec. 936, 469 N.E.2d 580, however, Rudi is inapplicable to the present case. In Rudi, the supreme court found that double jeopardy did not prevent a new trial after an acquittal because the first trial was a sham and did not have any of the traditional characteristics of such a proceeding. In this case, unlike Rudi, the trial was valid and had the traditional characteristics of such a proceeding.
Reversed.
MURRAY and GORDON, JJ., concur.
