
996 S.W.2d 845 (1999)
STATE of Tennessee, Appellee,
v.
Gilbert SMITH, Appellant.
Court of Criminal Appeals of Tennessee, at Knoxville.
February 18, 1999.
Application for Permission to Appeal Denied July 12, 1999.
*846 Raymond Mack Garner, District Public Defender, Maryville (At Trial), John E. Herbison, Nashville (On Appeal), for the Appellant.
John Knox Walkup, Attorney General of Tennessee, and Ellen H. Pollack, Assistant Attorney General of Tennessee, Nashville, TN, Michael L. Flynn, District Attorney General and Philip Morton, Assistant District Attorney General, Maryville, TN, for the Appellee.
Application for Permission to Appeal Denied by Supreme Court July 12, 1999.

OPINION
TIPTON, J.
The defendant, Gilbert Smith, appeals as of right from the sentence imposed by the Blount County Circuit Court upon his violation of the terms and conditions of the community corrections program. The defendant pled guilty to two counts of delivery of cocaine and was sentenced as a Range I, standard offender for a Class B felony to eight years for each count to be served concurrently. The trial court also imposed a two-thousand-dollar fine for each count. The trial court permitted the defendant to serve his sentence in the community corrections program. After his second violation of the program, the trial court revoked his community corrections sentence and resentenced the defendant to two concurrent ten-year terms to be served in the custody of the Department of Correction. The defendant contends (1) that the indictments are defective and therefore void because they fail to allege a culpable mental state and (2) that his sentences are illegal because he was sentenced for two Class B felonies while the indictments allege Class C felonies. The trial court is affirmed.

I. SUFFICIENCY OF THE INDICTMENTS
The defendant challenges the sufficiency of the indictments contending that they fail to state an offense. He argues that the indictments are void because they do not allege the requisite mental state of "knowingly" as required by T.C.A. § 39-174-17(a). The defendant asserts that his guilty plea did not waive the issue of the defective indictments because the issue is jurisdictional in nature. The state contends that the defendant waived the issue by failing to raise it before trial as required by Rule 12(b)(2), Tenn. R.Crim. P.
Generally, defenses and objections based on defects in the indictment must be raised before trial. Tenn. R.Crim. P. 12(b)(2); State v. Randolph, 692 S.W.2d 37, 40 (Tenn.Crim.App.1985). If the defendant fails to raise the issue before trial, the issue is deemed to be waived. Tenn. R.Crim. P. 12(f); see Rhoden v. State, 816 S.W.2d 56, 61 (Tenn.Crim.App.1991).
However, Rule 12(b)(2) expressly states that jurisdictional defects or the failure to charge an offense "shall be noticed by the court at any time during the pendency of the proceedings...." If the indictment does not charge an offense, Rule 34, Tenn. R.Crim. P., permits an arrest of judgment if "filed within thirty days of the date [of] the order of sentence...." Moreover, we are required to determine "whether the trial and appellate court have jurisdiction *847 over the subject matter," even though the issue might not have been presented as a ground for relief on appeal. T.R.A.P. 13(b).
The entry of a valid guilty plea constitutes an admission of all facts alleged and a waiver of procedural and constitutional defects in the proceedings that occurred before the entry of the plea. On the other hand, this court has concluded that waiver "does not apply when the indictment fails to assert an essential element of the offense. In that circumstance, no offense has been charged. In consequence, subsequent proceedings are a nullity." State v. Perkinson, 867 S.W.2d 1, 6 (Tenn.Crim.App.1992). Although the defendants in Perkinson did not plead guilty, we believe that the reasoning applies equally to the situation in which a defendant pleads guilty to an indictment that does not allege an offense. In fact, in Dykes v. Compton, 978 S.W.2d 528, 529 (Tenn.1998), a habeas corpus case attacking an aggravated rape conviction resulting from a guilty plea, our supreme court acknowledged that the issue of whether an indictment failed to state an offense was cognizable in a habeas corpus case.
The indictments in the present case allege that the defendant "did unlawfully deliver a controlled substance, ... Cocaine, ... in violation of Tennessee Code Annotated, Section 39-17-417(c)(1), all of which is against the peace and dignity of the State of Tennessee." Pursuant to T.C.A. § 39-17-417(a)(2), a person commits an offense if he or she knowingly delivers a controlled substance. The defendant argues that because the indictments do not specify that he knowingly delivered cocaine, they fail to state offenses. The state responds that the indictments comply with applicable statutory requirements.
The proper form for an indictment is set forth in T.C.A. § 40-13-202. It states:
The indictment must state the facts constituting the offense in ordinary and concise language, without prolixity or repetition, in such a manner as to enable a person of common understanding to know what is intended, and with that degree of certainty which will enable the court, on conviction, to pronounce the proper judgment....
This court has previously held that the mens rea is an essential element of a felony drug offense that would need to be alleged in the indictment and that a citation to the statute would not suffice. See State v. Marshall, 870 S.W.2d 532, 537 (Tenn.Crim.App.1993), app. denied (Tenn. Sept. 7, 1993).
However, in State v. Preston Carter, 988 S.W.2d 145 (Tenn.1999), the Tennessee Supreme Court stated the following:
Alleging the mental state was a requirement of every indictment at common law. [See State v. Hill, 954 S.W.2d 725, 729 (Tenn.1997)]. In Hill, we noted that it is necessary to charge the mens rea if the statutory definition of the offense includes a mens rea. Id. This Court has relaxed the strict pleading requirements of common law as noted in Ruff v. State, 978 S.W.2d 95, 100 (Tenn.1998), by holding that an indictment which includes a reference to the criminal statute that sets forth the mens rea is sufficient to give a defendant notice of the applicable mental state. "Thus, where the constitutional and statutory requirements outlined in Hill are met, an indictment that cites the pertinent statute and uses its language would be sufficient to support a conviction." [Ruff,] at 100.
Op. at 149 (emphasis added). Although it is questionable whether Ruff actually holds that reference to the statute, by itself, suffices for the mens rea element, Carter effectively holds that it does suffice.
In Carter, the court was reviewing the felony murder counts in an indictment that did not include mens rea allegations even though the felony murder statute applicable at that time expressly provided that the killing be reckless. However, the counts included a number reference to the statute that included felony murder. The court held that the reference to the statute *848 provided sufficient notice to the defendant of the applicable mens rea and that the language of the felony murder counts was legally sufficient. The court did not address this court's holding in Marshall, although it cited the case in its analysis of the allegations in the indictment. We can only conclude, though, that Carter effectively overrules Marshall's holding that citation to the statute will not suffice relative to the mens rea element.
In the present case, the indictments refer to T.C.A. § 39-17-417(c)(1), which provides that a violation of T.C.A. § 39-17-417(a) with respect to cocaine is a Class B felony when the amount involved is one-half gram or more of a substance containing cocaine. As previously noted, T.C.A. § 39-17-417(a)(2) provides that a person commits an offense if he or she knowingly delivers a controlled substance. Under Carter's rationale, the fact that the indictments allege the unlawful delivery of cocaine and provide the statute that directs the defendant to the subsection containing the requisite mens rea leads us to conclude that the indictments are sufficient.

II. ILLEGAL SENTENCE
The defendant contends that because the amounts of cocaine were omitted, the indictments charge him with Class C felonies leaving the trial court without lawful authority to sentence him for Class B felonies. However, in State v. Jabbaul Pettus, 986 S.W.2d 540 (Tenn.1999), our supreme court held that the knowing, intelligent and voluntary entry of a guilty plea to a Class B cocaine felony waives any contention about the indictment not alleging the quantity of cocaine needed for a Class B felony. The circumstances in the present case are similar to those in Pettus. The defendant is not entitled to relief.
In consideration of the foregoing and the record as a whole, the judgment of the trial court is affirmed.
RILEY and WITT, JJ., concur.
