delivered the opinion of the court:
Petitioner appeals the dismissal of his petition for a writ of habeas corpus for its failure to state a cause of action.
Petitioner was indicted for the crime of aggravated battery on June 1, 1970. On January 14, 1971 he was found by a jury in a hearing pursuant to section 104 — 2 of the Code of Criminal Procedure (Ill. Rev. Stat. 1971, ch. 38, par. 104 — 2) to be incompetent to stand trial. On September 16, 1971, petitioner appeared before the trial court with counsel for another competency hearing. After waiving his right to a jury trial of the issue, petitioner was found competent. He thereupon entered his plea of guilty.
Petitioner did not take a direct appeal of his conviction and the time for such expired. Neither did he seek post-conviction relief. On December 3, 1974, petitioner filed a petition for a writ of habeas corpus under section 22.1 of the Habeas Corpus Act (Ill. Rev. Stat., ch. 65, par. 22.1), which makes it a cause for discharge that “* * 6 the court has exceeded the limit of its jurisdiction, either as to the matter, place, sum or person.” Upon motion of the State, the trial court dismissed the petition with a finding that it did not state a cause of action under the Habeas Corpus Act. Petitioner appeals, presenting us with the issue whether the trial court which accepted petitioner’s guilty plea lacked jurisdiction to accept that plea when petitioner, an adjudicated incompetent, waived the right to a jury determination of his competency.
*1077Petitioner’s position is that an adjudicated incompetent cannot be tried for a crime and it was a denial of due process to permit him to enter a guilty plea, per People v. McKinstray, 30 Ill.2d 611, 198 N.E.2d 829. He states it to be a fundamental precept that an incompetent defendant cannot waive any of his basic constitutional rights, citing Pate v. Robinson, 383 U.S. 375, 15 L.Ed.2d 815, 86 S.Ct. 836.
The statute which governed restoration proceedings at the time of petitioner’s hearing (Ill. Rev. Stat., ch. 38, par. 104 — 3(b)) has been interpreted to require a trial by jury. (People ex rel. Suddeth v. Rednour, 33 Ill.2d 278, 211 N.E.2d 281.) Furthermore it was held that a defendant in Illinois is unable to waive his statutory right to a determination of whether or not he had been restored to competency. People v. Johnson, 15 Ill.App.3d 680, 304 N.E.2d 688; People v. Polito, 21 Ill.App.3d 182, 315 N.E.2d 84.
Factually the Johnson and Polito cases are similar to the one under consideration and there is no question that if petitioner had brought his case here by direct appeal Johnson and Polito would require reversal. Our recent case of People v. Duhr, 27 Ill.App.3d 651, 327 N.E.2d 267, is not applicable. It was concerned with amendatory changes in the statute governing restoration hearings which became effective January 1, 1973, a time subsequent to petitioner’s restoration hearing and plea of guilty.
But the issue here is stated in terms of jurisdiction within the compass of the Habeas Corpus Act. Did the trial court lack jurisdiction of the person of petitioner to proceed to accept his plea of guilty following the improper restoration hearing?
“We have consistently held that a court has jurisdiction to release a prisoner on habeas corpus only where the original judgment under which the prisoner is incarcerated was void, viz., rendered by a court lacking jurisdiction of the subject matter or of the person of the defendant, or where ‘something has happened’ since his detention under the conviction to entitle the prisoner to release. [Citations.] The remedy is not available to review errors which only render the judgment voidable and are of a nonjurisdictional nature, even though a claim of a denial of constitutional rights is involved.”
Petitioner’s petition would be sufficient if he could allege facts which would show the trial court was without personal jurisdiction of defendant at the time of his plea of guilty. Petitioner relies upon People v. Santoro, 13 Ill.App.3d 426, 301 N.E.2d 175 (abstract opinion), where it is stated, *1078“While a plea of guilty waives all errors not jurisdictional, competency to stand trial, being a jurisdictional issue, cannot be waived.”
While we must agree with petitioner that it is a deprivation of due process to place him on trial or take his plea of guilty while he was an adjudicated incompetent, we note that this was not done in this case. Competency to stand trial was not waived. The only waiver was of a jury trial to determine competency. There was a restoration hearing at which petitioner was present in person and represented by counsel. Petitioner was found competent at that hearing and it was only after a finding of competency that his guilty plea was accepted. If it is granted that petitioner was entitled to trial by jury to determine his competency, but yet waived that right, does such waiver serve to deprive the court of jurisdiction to proceed? We think not. If the holding of Santoro is to the contrary, then we must decline to follow it.
It is held that the right to trial by jury does not extend to a hearing to determine the competency of a defendant to stand trial. (People v. Shadowens, 44 Ill.2d 70, 254 N.E.2d 484; People v. Brown, 43 Ill.2d 79, 250 N.E.2d 647; People v. Shanklin, 26 Ill.App.3d 167, 324 N.E.2d 711.) Thus, petitioner did not waive a constitutional right, and where there was a restoration hearing at which petitioner appeared in person and with counsel, the court would not be deprived of jurisdiction of the person of petitioner simply because the hearing was improperly conducted.
In the Frye case the supreme court was presented with a habeas corpus petition which alleged that the original judgment of conviction was invalid because defendant was not granted a hearing to determine sanity although there was a bona fide doubt of his sanity and that his sanity had not been proved beyond a reasonable doubt by the State. In denying the petition the court stated:
“There is no allegation in the petition of facts that would have deprived the circuit court of jurisdiction over the subject matter or the person of the appellant and there is no claim of any occurrence since the judgment of conviction which would entitle the appellant to release.” 42 Ill.2d 311, 313.
In People ex rel. Kalec v. Pate, 38 Ill.2d 350, 231 N.E.2d 434, the court considered a prisoner’s “petition for a sentence hearing” as a petition for habeas corpus. The petition alleged that the prisoner prior to his trial has been “sentence [sic]” to the Lincoln State School for the Mentally Retarded and had never been discharged, and it also made further allegations regarding mental incompetency. In denying the petition the court stated:
“However, the allegations thereof are clearly insufficient to raise any substantial question, for there is nothing suggested which *1079 would affect the jurisdiction over defendant of the court in which he was convicted nor is there any suggestion of any occurrence subsequent to conviction which would entitle defendant to release. Habeas corpus is of no assistance to defendant under these circumstances.” (Emphasis supplied.) 38 Ill.2d 350, 351-52.
In view of these authorities we find that although the proceeding which led to a finding that petitioner had been restored was improperly conducted it nevertheless did not serve to deprive the court of the jurisdiction of the person of petitioner nor of the subject matter with which it was concerned.
The trial court was correct in its finding that the petition for habeas corpus did not state a cause of action.
EARNS and CARTER, JJ., concur.