#### CARLO RAIMONDO, Petitioner-Appellant, v. ANN KILEY, Director, The Department of Mental Health and Developmental Disabilities, et al., Respondents-Appellees (Richard M. Daley, State’s Attorney of Cook County, Intervenor-Appellee).

First District (4th Division)

No. 87—0929

Opinion filed June 23, 1988.

*220Edwin F. Handel Legal Aid Clinic, of Chicago (Mark J. Heyrman, of counsel), for appellant.

Richard M. Daley, State’s Attorney, of Chicago (Kenneth T. McCully, Patricia Y. Brown, and Joseph G. Laspisa, Assistant State’s Attorneys, of counsel), for appellees.

JUSTICE LINN

delivered the opinion of the court:

Petitioner, Carlo Raimondo, sought a writ of habeas corpus from the circuit court of Cook County. The writ would have ordered his release from the custody of the Illinois Department of Mental Health and Developmental Disabilities (the Department of Mental Health). Petitioner has been in the custody of the Department of Mental Health since 1975, pursuant to a court order that committed him following a finding that he was not guilty by reason of insanity. The trial court denied the petition.

Petitioner appeals, contending: (1) this court, in a previous appeal, erred in failing to apply retrospectively to him all of the provisions of the post-acquittal confinement statute; (2) his waiver of his ex post facto rights removes the constitutional barriers identified in our previous decision; (3) the failure to apply to him all of the provisions of the post-acquittal confinement statute deprives him of equal protection of law and constitutes special legislation prohibited by the Illinois Constitution; and (4) the trial court erred in denying the petition for writ of habeas corpus.

We affirm the order of the trial court and remand with directions.

Background

This cause is before us a second time. (Raimondo v. Pavkovic (1982), 107 Ill. App. 3d 226, 437 N.E.2d 712 (Raimondo I).) The pertinent background and statutory history are found in Raimondo I, Lee v. Pavkovic (1983), 119 Ill. App. 3d 439, 456 N.E.2d 621, and elsewhere. We will repeat only those facts that are necessary to dispose of this appeal.

A

The trial court found petitioner not guilty of his crimes by reason *221of insanity. (Ill. Rev. Stat. 1975, ch. 38, pars. 6 — 2, 1005 — 2—4.) Accordingly, on January 9, 1975, the trial court committed petitioner to the Department of Mental Health. Under the then-effective version of the Unified Code of Corrections (Corrections Code), a trial court would order the “criminal” commitment of a defendant for no longer than 12 months. At the end of this period, the defendant’s “civil” commitment began. This civil commitment was governed by the then-effective Mental Health Code of 1967 (Ill. Rev. Stat. 1975, ch. 91 xk, par. 1 — 1 et seq.-, the trial court was no longer directly involved. (Ill. Rev. Stat. 1975, ch. 38, par. 1005 — 2—4; ch. 91^2, par. 1 — 1 et seq.) The defendant’s civil commitment was indefinite, lasting for as long as he needed hospitalization for medical treatment. (Ill. Rev. Stat. 1975, ch. 911/2, par. 10 — 1.) Thus, petitioner was in custody indefinitely under a civil commitment as of January 9,1976.

During petitioner’s civil commitment, our legislature amended both the Code of Corrections and the Mental Health Code. The amended section 5 — 2—4 of the Corrections Code did away with the initial, maximum 12-month commitment period and subsequent indefinite civil commitment. The amended statute directs the trial court to calculate the maximum length of time that a defendant could have served had he been convicted of the most serious crime charged, less credit for good time behavior and before becoming eligible for parole. The trial court then enters an initial commitment order, which may not exceed this amount of time. The initial commitment order acts as an automatic release date. After such time expires, the defendant must be civilly committed or released. Ill. Rev. Stat. 1985, ch. 38, par. 1005 — 2—4.

Section 5 — 2—4 additionally requires that notice of a proposed discharge be provided to both the court and the State’s Attorney, either of whom could object. In case of an objection, the superintendent of the facility may not discharge a defendant until after a hearing. (Ill. Rev. Stat. 1985, ch. 38, par. 1005 — 2—4(d).) Further, the decision to discharge is then no longer that of the superintendent, but that of the court, after a hearing. Ill. Rev. Stat. 1985, ch. 38, pars. 1005 — 2—4(d), (g) through (i).

Lastly, section 5 — 2—4 additionally provides that if a conflict occurs between it and the Mental Health and Developmental Disabilities Code, its (the Corrections Code’s) provisions would govern. Also, the section provides that its amendments would apply to all persons previously found not guilty by reason of insanity and who are presently committed to the Department of Mental Health. Ill. Rev. Stat. 1985, ch. 38, pars. 1005 — 2—4(k), (1).

*222Also during petitioner’s commitment, our legislature repealed the Mental Health Code of 1967 and replaced it with the Mental Health and Developmental Disabilities Code (MHDDC) (Ill. Rev. Stat. 1985, ch. 91V2, par. 1 — 100 et seq.). Sections 3 — 813 and 3 — 815 of the MHDDC provide that any order placing a person in the custody of the Department of Mental Health is valid for only 60 days. Additional 180-day custody periods may be sought. (Ill. Rev. Stat. 1985, ch. 9IV2, pars. 3 — 813, 3 — 815.) However, section 3 — 200 of the MHDDC provides that defendants transferred to the Department of Mental Health by the Department of Corrections under the Corrections Code may be released only as provided by the Corrections Code. Ill. Rev. Stat. 1985, ch. 9IV2, par. 3 — 200.

B

In Raimondo I, this court reversed the trial court’s denial of petitioner’s first habeas corpus petition. The trial court denied the petition, but treated it as one for discharge under section 5 — 2—4 of the Corrections Code. (Ill. Rev. Stat. 1985, ch. 38, par. 1005 — 2—4.) The court ruled that the entire section should apply to petitioner. Since petitioner was committed prior to the amendment of section 5 — 2—4, he never received an initial commitment order. The trial court, therefore, held a hearing to determine the maximum sentence that petitioner could have served had he been convicted. Based on its calculations, the court then entered an initial commitment order with a release date of November 12, 1986. Raimondo, 107 Ill. App. 3d at 228-29, 437 N.E.2d at 713-14.

This court reversed the trial court’s imposition of the initial commitment order on petitioner. We noted that under the amended section 5 — 2—4(b), the initial commitment order represented a defendant’s criminal commitment. We also noted that petitioner already served his initial criminal commitment under the old statute. We found, therefore, that the trial court attempted to establish a second criminal commitment for petitioner. 107 Ill. App. 3d at 231-32, 437 N.E.2d at 715-16.

We concluded that such an application of the amended statute to petitioner would violate the ex post facto clauses of the Federal and Illinois Constitutions. (U.S. Const., art. I, §10; Ill. Const. 1970, art. 1, §16.) We stated that the legislature could not enact a statute that would impose a new criminal commitment on persons in petitioner’s situation by amending section 5 — 2—4(b) to provide for longer criminal commitments and making the amendment retroactive. We reasoned, therefore, that the trial court could not accomplish the same *223result by applying the statute retroactively, a statute which is clearly constitutional when applied only prospectively. We held, therefore, that while the remainder of section 5 — 2—4(b) applied to petitioner, the initial commitment order clause of the section could have no impact on petitioner’s status. Raimondo, 107 Ill. App. 3d at 232-33, 437 N.E.2d at 716-17.

We now summarize the effect of the statutory amendments and of our decision in Raimondo I on petitioner. He was serving an indefinite civil commitment under the old Mental Health Code. The amended Corrections Code, however, made its (the Corrections Code’s) provisions applicable to petitioner. Further, although the new MHDDC granted persons in its custody the benefit of periodic review, it also provided that persons in petitioner’s situation may be released only as provided by the Corrections Code. Raimondo I thereafter made inapplicable to petitioner the initial commitment order clause of section 5 — 2—4(b), which acts as an automatic release date. Petitioner, therefore, is under an indefinite civil commitment and can be discharged therefrom only under section 5 — 2—4(b) of the Corrections Code. This, nevertheless, left petitioner with several avenues under section 5 — 2—4(b) for obtaining his release, which we mentioned in Raimondo I. 107 Ill. App. 3d at 233, 437 N.E.2d at 717.

C

This brings us to the present appeal. The record shows that on July 25, 1986, petitioner signed a document that purported to be a waiver of his right, under the ex post facto clauses of the Federal and Illinois Constitutions, not to be subjected to the initial commitment order clause of Corrections Code section 5 — 2—4(b). Since petitioner waived his ex post facto rights, he claimed that he should be released on November 12, 1986. This was the release date of the initial commitment order that we reversed in Raimondo I. On that date, respondents, Department of Mental Health officials, refused to release petitioner. He filed that day another petition for writ of habeas corpus. The trial court subsequently granted the State’s Attorney’s petition to intervene in the matter.

Petitioner moved for summary judgment on the petition. Both the respondents and the State’s Attorney moved to deny the petition. At the close of a hearing on February 26, 1987, the trial court denied the petition. This appeal follows.

*224Opinion

I

Petitioner first contends that the provisions of Corrections Code section 5 — 2—4(b) apply to him in toto, including the initial commitment order clause. He raises various arguments based on statutory language and history, and case law. We decided this precise issue in Raimondo I. Without expressly saying so, petitioner now essentially asks us to reverse Raimondo I. This we decline to do.

II

Petitioner next contends that his purported waiver of his ex post facto rights removed the constitutional barriers that we identified in Raimondo I. He notes that we based our reversal of the initial commitment order in Raimondo I on ex post facto considerations. Petitioner reasons that since he waived his ex post facto right not to be subjected to the initial commitment order clause of Corrections Code section 5 — 2—4(b), then the initial commitment order, with its November 12,1986, release date, was automatically reinstated.

We disagree. Article I, section 10, of the United States Constitution provides in pertinent part:

> “No State shall enter into any Treaty, Alliance, or Confederation; grant Letters of Marque and Reprisal; coin Money; emit Bills of Credit; make any Thing but gold and silver Coin a Tender in Payment of Debts; pass any Bill of Attainder, ex post facto Law, or Law impairing the Obligation of Contracts, or grant any Title of Nobility.” U.S. Const., art. I, §10.

See also Ill. Const. 1970, art. I, §16.

The ex post facto prohibition forbids the States to enact any law “ ‘which imposes a punishment for an act which was not punishable at the time it was committed; or imposes additional punishment to that then prescribed.’ ” (Weaver v. Graham (1981), 450 U.S. 24, 28, 67 L. Ed. 2d 17, 22, 101 S. Ct. 960, 964, quoting Cummings v. Missouri (1867), 71 U.S. (4 Wall.) 277, 325-26, 18 L. Ed. 356, 363-64.) One of the purposes of the ex post facto prohibition was to secure substantial personal rights against arbitrary and oppressive legislative action. Weaver, 450 U.S. at 29, 67 L. Ed. 2d at 23, 101 S. Ct. at 964, citing Malloy v. South Carolina (1915), 237 U.S. 180, 183, 59 L. Ed. 905, 906, 35 S. Ct. 507, 508.

Further, petitioner is correct that a party generally may waive a substantive rule of law, a statute, and even a constitutional provision enacted for his or her personal benefit. (Chieago-Sandoval *225 Coal Co. v. Industrial Comm’n (1922), 301 Ill. 389, 391-92, 134 N.E. 158, 159; Meyer v. Meyer (1948), 333 Ill. App. 450, 465, 77 N.E.2d 556, 563.) True, courts do not presume waiver of constitutional rights; indeed, courts indulge every reasonable presumption against waiver. (Johnson v. Zerbst (1938), 304 U.S. 458, 464, 82 L. Ed. 1461, 1466, 58 S. Ct. 1019, 1023.) However, a party may waive a constitutional right, precisely like any other right. Oak Park National Bank v. City of Chicago (1973), 10 Ill. App. 3d 258, 263, 294 N.E.2d 42, 45.

The ex post facto prohibition, however, has purposes other than the securing of personal rights. Through the prohibition, the Framers sought to assure that statutes give fair warning of what conduct the State deems criminal and the punishment that the State may impose. Further, the prohibition permits individuals to rely on the meaning of statutes until explicitly changed. (Weaver, 450 U.S. at 28-29, 67 L. Ed. 2d at 23, 101 S. Ct. at 946; People v. Coleman (1986), 111 Ill. 2d 87, 93-94, 488 N.E.2d 1009, 1012.) The ex post facto prohibition also upholds the doctrine of separation of powers. The prohibition confines the legislature to enacting penal statutes with only prospective effect and confines the executive and judiciary to applying existing penal law. Weaver, 450 U.S. at 29 n.10, 67 L. Ed. 2d at 23 n.10, 101 S. Ct. at 964 n.10.

Applying these principles to the instant case, we conclude that petitioner’s purported waiver has no effect on his confinement. The ex post facto prohibition does secure personal rights. However, it also serves as an unconditional prohibition to certain types of legislative action. Indeed, an individual cannot waive the ex post facto prohibition, as he or she cannot waive the prohibition against the State passing a bill of attainder or granting a title of nobility. We hold that petitioner could not waive the application of the ex post facto clauses of the Federal and fllinois Constitutions to his commitment under section 5 — 2—4(b) of the Corrections Code.

Ill

A

Petitioner next contends that the failure to apply to him the initial commitment order clause of Corrections Code section 5 — 2— 4(b) denies him equal protection of law. A denial of equal protection is an arbitrary and invidious discrimination against a person or class of persons. It results when government withholds from the person or class a right, benefit, or privilege without a reasonable basis for so *226doing. (Chicago National League Ball Club, Inc. v. Thompson (1985), 108 Ill. 2d 357, 367, 483 N.E.2d 1245, 1250; Illinois Polygraph Society v. Pellicano (1980), 83 Ill. 2d 130, 138, 414 N.E.2d 458, 462-63.) To comply with equal protection requirements, a reasonable basis must exist for distinguishing the class to which a statute applies from the class to which the law does not apply. People v. Coleman (1986), 111 Ill. 2d 87, 95, 488 N.E.2d 1009, 1013.

Petitioner argues that no rational basis exists for distinguishing between him and those acquitted by reason of insanity who now are entitled to the initial commitment order, with its automatic release date. We previously have rejected this exact argument involving the same statutory provision. “Merely because the legislature sees fit to change the law does not give rise to an equal protection attack on those who, at some previous time, did not have the benefit of the new statute.” (Lee v. Pavkovic (1983), 119 Ill. App. 3d 439, 447, 456 N.E.2d 621, 627.) We adhere to this view.

B

Petitioner also contends that the failure to apply to him the initial commitment order clause of Corrections Code section 5 — 2— 4(b) has the effect of special legislation. The Illinois Constitution forbids our legislature to pass a special or local law when a general law is or can be made applicable. (Ill. Const. 1970, art. IV, §13.) Special legislation confers a special benefit or exclusive privilege on a person or class of persons to the exclusion of others similarly situated. It arbitrarily and unreasonably discriminates in favor of a select group. (Jenkins v. Wu (1984), 102 Ill. 2d 468, 478, 468 N.E.2d 1162, 1167, quoting Illinois-Polygraph Society v. Pellicano (1980), 83 Ill. 2d 130, 137-38, 414 N.E.2d 458, 462.) In reviewing a special legislation claim, the test is the same as that for an equal protection challenge. The court must determine whether a real difference exists between those classified, a difference that rationally explains the different treatment accorded to them. Jenkins, 102 Ill. 2d at 478, 468 N.E.2d at 1167.

Applying these principles to the case at bar, we reject petitioner’s special legislation claim for the same reasons that we rejected his equal protection challenge. Lee v. Pavkovic (1983), 119 Ill. App. 3d 439, 447, 456 N.E.2d 621, 627.

IV

Petitioner next contends that the trial court erred in ruling that his remedy lay in a petition for discharge under Corrections *227Code section 5 — 2—4(b) and not a petition for writ of habeas corpus. This argument lacks merit. We addressed this exact issue in Raimondo I. Petitioner alleges that his period of lawful confinement expired. This allegation is a basis for relief under the habeas corpus statute. (Ill. Rev. Stat. 1985, ch. 110, par. 10 — 124(2).) Consequently, the trial court erred.

The trial court’s error, however, was harmless because it ruled on the substantive relief that petitioner sought, his release from custody. (Raimondo, 107 Ill. App. 3d at 229, 437 N.E.2d at 714.) We additionally held that the evidentiary requirements for proof of entitlement to discharge are the same under either theory. (107 Ill. App. 3d at 233, 437 N.E.2d at 717.) Petitioner, therefore, was not prejudiced in any way.

Petitioner lastly contends that the trial court based its ruling on personal opinion and other information outside of the record. We disagree. It is the duty of the trial court to make its determinations only after hearing all of the evidence with an open mind. (People v. Licata (1973), 15 Ill. App. 3d 652, 654, 305 N.E.2d 6, 8.) After carefully reviewing the entire record in the case at bar, we conclude that the trial court performed its duty.

We hold that petitioner has not shown any constitutional or other impediment to his continued confinement with the Department of Mental Heath. However, considerations of fairness and substantial justice lead us to remand this cause to the trial court with directions to consider the petition for writ of habeas corpus as a petition for discharge under Corrections Code section 5 — 2—4(b). Lee v. Pavkovic (1983), 119 Ill. App. 3d 439, 447, 456 N.E.2d 621, 627.

For the foregoing reasons, the order of the circuit court of Cook County is affirmed and the cause remanded to the trial court with directions.

Affirmed and remanded with directions.

JIGANTI, P.J., and McMORROW, J., concur.