Donald Markell Succop appeals from an order of commitment adjudging him to be a probable mentally disordered sex offender1 and directing that he be confined in a state hospital for observation and diagnosis for a period not to exceed 90 days.
*485Succop, who represented himself at the trial, was found guilty by a jury of indecent exposure (Pen. Code, § 314, subd. 1). He admitted two prior convictions of the same offense. The court was of the view that he might be a mentally disordered sex offender and appointed two psychiatrists to examine him and ordered a probation report.
Subsequently the court stated that the court-appointed psychiatrists had reported that Succop was a possible sexual psychopath' and that the court was going to commit him to a state hospital for observation. Succop said that he had sent the court a request for a subpoena of certain hospital records and thought he had a right to cross-examine the psychiatrists. The court stated that it was not holding a hearing. At that point the court adjudged defendant to be a probable mentally disordered sex offender,2 and the order directed that he be confined at a designated hospital for observation and diagnosis for a period not to exceed 90 days.
At the hospital Succop was found to be a mentally disordered sex offender not amenable to treatment and was returned to the superior court for further proceedings. Judgment was thereafter entered sentencing him to the state prison for the term prescribed by law. The judgment further recites *486that “It appearing to the Court from the report of the [hospital superintendent] that the defendant is a menace to the health and safety of others and will not benefit by treatment in a state hospital, probation denied.”
‘‘ [U] nder the general rule, an order is not appealable unless declared to be so by the Constitution or by statute.” (People v. Keener (1961) 55 Cal.2d 714, 720 [12 Cal.Rptr. 859, 361 P.2d 587], and eases cited; accord, In re Corey (1964) 230 Cal.App.2d 813, 820 [41 Cal.Rptr. 379].) The appealability of orders arising out of sexual psychopathy proceedings is governed by Code of Civil Procedure section 963. (People v. Gross (1955) 44 Cal.2d 859, 860 [285 P.2d 630].) Under that section, insofar as relevant here, an order is appealable only if it is specifically listed in subdivision 2 thereof or may be characterized under subdivision 1 as ‘ ‘ a final judgment entered in an action, or special proceeding, commenced in a superior court. ...” The order here challenged is not among those mentioned in subdivision 2 of section 963; the question to be determined, therefore, is whether it may properly be deemed a “final judgment. ’ ’
Code of Civil Procedure section 1064 declares that “A judgment in a special proceeding is the final determination of the rights of the parties therein.” (Italics added.) “It has been correctly stated that the general test for determining whether the judgment is final is ‘that where no issue is left for future consideration except the fact of compliance or non-compliance with the terms of the first decree, that decree is final, but where anything further in the nature of a judicial action on the part of the court is essential to a final determination of the rights of the parties, the decree is interlocutor. ’ (Lyon v. Goss, 19 Cal.2d 659, 670 [123 P.2d 11]. See In re Los Angeles County Pioneer Soc., 40 Cal.2d 852, 858 [257 P.2d 1] ; Bakewell v. Bakewell, 21 Cal.2d 224, 227 [130 P.2d 975] ; Sharon v. Sharon, 67 Cal. 185, 195 [7 P. 456, 635, 8 P. 709].) ” (Meehan v. Hopps (1955) 45 Cal.2d 213, 217 [288 P.2d 267].) An examination of the relevant statutes demonstrates that the order before us does not amount to a “final judgment” under the foregoing test, and hence is not separately appealable.
The order was made pursuant to Welfare and Institutions Code section 5512, which provides in relevant part that “If, after examination and hearing, it appears there is sufficient cause to believe that the person is a mentally disordered sex offender within the meaning of this article, the judge may *487make and sign an order that the person be placed temporarily in a suitable psychiatric facility maintained by a county or in a state hospital of the Department of Mental Hygiene designated by the court for observation and diagnosis for a period not to exceed 90 days, ...” (Italics added.) We first note that this portion of the statute is phrased in terms of a temporary “observation placement,” in contrast to the language of “commitment for an indeterminate period,” appearing in later paragraphs. The distinction is meaningful, for one is a prerequisite to the other. Thus if the superintendent of the hospital, after observation and diagnosis, reports to the court that the person is not a mentally disordered sex offender, the person shall be returned to the court in which the criminal charge was tried “to await further action with reference to such criminal charge. ’ ’ If the superintendent reports that the person is a mentally disordered sex offender and could benefit by treatment in a state hospital, “the court in its discretion has the alternative to return the person to the criminal court for further disposition or may make an order committing the person to the department for placement in a state hospital for an indeterminate period. ...” If, as in the present ease, the superintendent reports that the person is a mentally disordered sex offender but will not benefit by treatment and is a danger to the health and safety of others, the court in which the criminal charge was tried has two alternatives: It may resume the criminal proceedings and “impose sentence or make such other suitable disposition of the case as the court deems necessary ”; or it may recertify the person to the civil court for a second hearing, which may in turn result in an order committing him to a state hospital for an indeterminate period.
In summary, an order for a temporary observation placement is but one of several interim steps in a complicated proceeding which begins with suspension of the criminal trial or sentence and certification of the person for hearing, and ends either with resumption of the criminal case or with commitment of the person to the Department of Mental Hygiene for an indeterminate period. There are still other procedural steps the person may demand be taken, such as a further hearing in the committing court (Welf. & Inst. Code, § 5512, fifth par.) or a trial by jury (§ 5512.5) ; but the foregoing recital will suffice to show, in the language of the “final judgment” test, it is not true that “no issue is left for future consideration” by the making of an order for a temporary observation *488placement. Rather, nothing is settled by that order, and much “in the nature of a judicial action” remains to be done which is “essential to a final determination of the rights of the parties” (Meehan v. Hopps (1955) supra, 45 Cal.2d 213, 217).
We conclude, therefore, that the order confining the defendant in a state hospital for observation and diagnosis for a period of not to exceed 90 days is not an appealable order.
The defendant further contends that at the proceedings leading to his commitment the trial court failed to afford him a hearing as required by due process and certain statutory provisions (Welf. & Inst. Code, § 5503 et seq.). The defendant, however, was not without an effective remedy at this point. “Every person unlawfully imprisoned or restrained of his liberty, under any pretense whatever, may prosecute a writ of habeas corpus, to inquire into the cause of such imprisonment or restraint.” (Pen. Code, § 1473.) In a number of similar contexts it has been held that a writ of habeas corpus will issue to release from custody one who has been subjected to defective proceedings leading to an order of civil commitment. Such relief has been granted in cases of commitment for narcotics addiction (In re Jones (1964) 61 Cal.2d 325 [38 Cal. Rptr. 509. 392 P.2d 269] ; In re Raner (1963) 59 Cal.2d 635 [30 Cal.Rptr. 814, 381 P.2d 638]), insanity (In re Hofmann (1955) 131 Cal.App.2d 758 [281 P.2d 96]), inebriacy (In re Wright (1939) 31 Cal.App.2d 166 [88 P.2d 186]), intemperate use of stimulants (In re Crowley (1928) 95 Cal.App. 219 [272 P. 787]), and after declaration of wardship in a juvenile proceeding (In re Moilanen (1951) 104 Cal.App.2d 835, 842 [233 P.2d 91], and cases cited). In each of the foregoing instances the person committed was denied procedural rights substantially identical with those denied to defendant in the case before us, and on a petition for habeas corpus the confinement was terminated.
We have heretofore taken notice of the close analogy between sexual psychopathy statutes and those, for example, relating to commitment for narcotic addiction. (People v. Victor (1965) 62 Cal.2d 280, 288-289 [42 Cal.Rptr. 199, 398 P.2d 391] ; In re De La O (1963) 59 Cal.2d 128, 156 [28 Cal.Rptr. 489, 378 P.2d 793, 98 A.L.R.2d 705].) By the same analogy, it appears habeas corpus should lie to inquire into the legality of an institutional confinement, however temporary, ordered on the basis of defective sexual psychopathy commitment proceedings. Thus in In re Stone (1948) 87 Cal.App.2d 777 [197 P.2d 847], the petitioner was adjudged a sexual psychopath and committed for an indeterminate period to a state hospital. In *489the ensuing five years the hospital superintendent twice certified that he was still a sexual psychopath but would not benefit by further treatment, and returned him to court for disposition of the criminal case; on each occasion, however, the court recommitted him to the state hospital in the absence of either evidence or finding that he would benefit by further treatment, and over his express demand to be tried on the criminal charge. The Court of Appeal held that under Welfare and Institutions Code section 5502.5 as it then read the trial court “exceeded its powers” in recommitting the petitioner after he had been returned to court by the hospital superintendent; accordingly, a writ of habeas corpus was granted and the court directed that “petitioner is entitled to his discharge from the custody of the said hospital; and it is so ordered. ’3
The remedy of habeas corpus is particularly effective in this context, of course, because it is speedy. A petition for the writ, if promptly filed, can ordinarily be ruled upon well within the 90-day limit of a temporary observation placement. In the case at hand that period has long since expired.
Whatever merit there may be in defendant’s claim that he was denied a proper hearing may be reviewed on the appeal from the judgment of conviction, which appeal is now pending. (Pen. Code, § 1237, subd. 1; People v. Fuller (1964) 226 Cal.App.2d 331 [38 Cal.Rptr. 25]; People v. Elliott (1958) 158 Cal.App.2d 623 [322 P.2d 1029].)4
*490This purported appeal from the order adjudging defendant to be a probable mentally disordered sex offender is dismissed.
Traynor, C. J., McComb, J., Peters, J., Tobriner, J., Mosk, J., and Peek, J.,* concurred.
The minute order contains two conflicting recitals on this point. The typewritten portion of the order declares that the proceedings were suspended and defendant was committed for observation, “It appearing to the Court from the reports of doctors heretofore appointed that the defendant is a probable mentally disordered sex offender.’’ (Italics added.) This determination, it will be admitted, is a perfectly proper one. Unfortunately, the order was recorded on a form which also contains the following printed statement: “Now, therefore, the Court finds from the evidence, that said alleged defendant is a mentally disordered sex offender within the meaning of Chapter 4 of Part I of Division VI of the Welfare and Institutions Code.” (Italics added.) A similar printed statement then purports to adjudge and decree that defendant *485is a mentally disordered sex offender within the meaning of the same chapter.
It is obvious on its face that the printed portion of the minute order is a relic of the former statutory scheme for commitment of sexual psychopaths, for ‘ ‘ Chapter 4 of Part I of Division VI ’ ’ of the code now has nothing to do with that topic and deals instead with the appointment and powers of a public guardian. The recital that defendant is a mentally disordered sex offender "within the meaning of" that chapter is therefore itself meaningless. In In re Raner (1963) 59 Cal.2d 635, 642, fn. 9 [30 Cal.Rptr. 814, 381 P.2d 638], we likewise noted and condemned ‘ ‘ the use of inappropriate, inflexible, or outdated printed forms" in a narcotics addiction commitment proceeding, and as an example mentioned "the ‘minutes’ of the commitment hearing."
Under well-known principles of construction, we give credence to the typewritten portion of the order specially drafted for this case rather than to outdated formbook recitals printed therein for general use.
Further support in the record for this interpretation is found in the trial minutes for June 8, 1965, the date the verdict of guilty was rendered. After the ,iury was discharged an order was made appointing two doctors to examine defendant, "It appearing to the Court that defendant may be a, mentally disordered sex offender." (Italics added.)
In any event, the conflict on the face of the order is easily removed. An appellate court has the power to modify the wording of the order to conform to law. (People v. Good (1963) 223 Cal.App.2d 298, 301-302 [35 Cal.Rptr. 825].) The matter should be resolved on defendant’s appeal pending in the Court of Appeal and that court can simply strike the offending surplusage.
See footnote 1, ante, p. 484.
In People v. Gross (1956) 139 Cal.App.2d 607, 610 [294 P.2d 88], the court correctly observed that In re Stone, supra (87 Cal.App.2d 777) “no longer is a precedent’’ on the substantive question of the power of the trial court to recertify to state hospital one who has been returned to court by the hospital superintendent; this change in the law was brought about by the enactment of Welfare and Institutions Code sections 5517 and 5518, which created a special procedure for such certification in certain eases. But nothing in Gross easts any doubt upon the propriety of the remedy employed in Stone. As we observed in In re De La O (1963) supra, 59 Cal.2d 128, 142, the right to petition for habeas corpus flows not from any statutory enactment “but from the basic constitutional guarantee that ‘ The privilege of the writ of habeas corpus shall not be suspended. . . .’ (U.S. Const., art. I, § 9, cl. 2; Cal. Const., art. I, §5.)”
In the present ease the court initiated the commitment proceedings ibefore pronouncing judgment. Under Welfare and Institutions Code section 5501, however, those proceedings may also be commenced after pronouncing judgment, in which event the court “suspends [the execution of] the sentence.” If the latter course is adopted the defendant who wishes to appeal must do so forthwith, as a criminal judgment is appealable even though execution thereof has been suspended. (People v. Howerton (1953) 40 Cal.2d 217, 219 [253 P.2d 8].) But such an appeal cannot reach any errors occurring in the ensuing commitment proceedings. Accordingly, when the commitment proceedings in those eases terminate and the criminal court orders the suspended sentence *490previously imposed to be placed into effect, the defendant lias the right to a separate appeal from the latter order as one "made after judgment, affecting [his] substantial rights’’ (Pen. Code, § 1237, subd. 3), provided that appeal is directed only to matters occurring in the post-judgment commitment proceedings and does not raise issues which could have been reviewed on a timely appeal from the suspended judgment itself.
Retired Associate Justice of the Supreme Court sitting under assignment by the Chairman of the Judicial Council.