
283 N.W.2d 887 (1979)
STATE of Minnesota, Respondent,
v.
Robert C. PIETRASZEWSKI, Appellant.
No. 48516.
Supreme Court of Minnesota.
July 20, 1979.
*888 C. Paul Jones, Public Defender, Robert E. Oliphant and Allen E. Christy, Jr., Asst. Public Defenders, Minneapolis, for appellant.
Warren Spannaus, Atty. Gen., Thomas L. Fabel, Deputy Atty. Gen., Jane Prohaska, Spec. Asst. Atty. Gen., W. M. Gustafson, County Atty., St. Peter, for respondent.
*889 Heard before ROGOSHESKE, TODD, and WAHL, JJ., and considered and decided by the court en banc.
PER CURIAM.
Defendant was convicted by the Nicollet County District Court, sitting without a jury, of introducing contraband into the Minnesota Security Hospital in violation of Minn.St. 243.55. The issues on appeal are: (1) whether defendant's waiver of a jury trial was invalid; (2) whether Minn.St. 243.55 applies to the Minnesota Security Hospital; (3) whether the search of defendant's cell violated the Fourth Amendment; (4) whether the trial court erred by permitting two witnesses, whose names had not been previously disclosed, to testify; (5) whether the evidence is insufficient; and (6) whether the trial court made erroneous evidentiary rulings. We affirm.
Defendant is committed to the Minnesota Security Hospital as a psychopathic personality and is concurrently serving a life sentence for two felonies. At the time of this occurrence he resided in Ward A-6, where he was also employed as a janitor. Ward A-6 is divided by a locked gate into a day side and a dorm side. Some of the residents of that ward, including defendant, sleep in an adjoining locked cellblock rather than the dorm.
In May 1977, Anthony Lausche, a former resident of the Minnesota Security Hospital and an acquaintance of defendant's, purchased a Smith and Wesson snub-nosed revolver in Montana at defendant's request. Lausche later purchased 50 rounds of ammunition for the gun in Mankato. Defendant had promised Lausche $3,000 in return for procuring the gun  $500 on delivery, and $2,500 later.
On the evening of May 31, 1977, Lausche climbed the security fence surrounding the grounds of the Minnesota Security Hospital with the gun and ammunition in his possession. At the same time, defendant, who had been cleaning the day side of the ward, was admitted to the dorm side. Defendant entered the bathroom on the dorm side, lowered a sheet to Lausche, and pulled the gun and ammunition into the Minnesota Security Hospital. Lausche had been seen climbing the fence and was apprehended. He was questioned, permitted to shower, and released.[1] While Lausche was showering on the day side of Ward A-6, defendant, who had returned to that side of the ward, showed him an envelope with $550 in it but refused to give it to him fearing he would be searched when he left the hospital.
Bruce Hess, a resident of Ward A-6, testified that defendant spoke to him about 11 p. m. on May 31, while he was on the dorm side and defendant was cleaning the day side. Defendant offered Hess $100 if he would retrieve the gun from the game cupboard on the dorm side and hide it behind a radiator. Hess did not agree immediately, worried about it, and finally hid it in his boots. The next morning the guards searched the unit and immediately discovered the gun and ammunition in his boots. On June 4, the guards searched defendant's cell and discovered $725 in a small white envelope taped inside a heating vent. Defendant was then placed in an isolation cell, where he remained during trial.
1. Defendant's first claim is that his waiver of a jury trial was not intelligently and voluntarily made due to his mental condition and the stress he experienced in being confined to a dirty isolation cell without exercise and without visitation.[2] A defendant in a criminal case may waive a jury trial if the court approves and if the waiver *890 is made orally or in writing after the defendant has been advised of his rights and has had an opportunity to consult with counsel. Rule 26.01, subd. 1(2)(a), Minnesota Rules of Criminal Procedure. The trial court has discretion whether to accept the waiver and should be satisfied that defendant was informed of his rights and that the waiver was voluntary. See, Gaulke v. State, 289 Minn. 354, 184 N.W.2d 599 (1971).
The mere fact that the defendant is incarcerated or committed because of mental illness is not sufficient to invalidate a waiver. A commitment because of mental illness is not a determination that a defendant is legally incompetent, see, Minn.St. 253A.18, nor does it preclude a witness from testifying, see, State ex rel. Dugal v. Tahash, 278 Minn. 175, 153 N.W.2d 232 (1967). This defendant was considered a security risk and would have received little exercise or visitation wherever he was incarcerated pending trial.
The only record of defendant's waiver was at the beginning of trial:
"THE COURT: The next question, Mr. Pietraszewski, your counsel tells me that you were willing and in fact preferred to waive jury for the purpose of this Trial, but I want to confirm that for the record at this time.
"MR. PIETRASZEWSKI: That's true, Your Honor.
"THE COURT: All right. . . ."
The trial court should have questioned defendant more thoroughly in open court to determine whether he was aware of his right to a jury trial and had conferred with his attorney about the consequences of a waiver. See, Rule 26.01, subd. 1(2)(a). The failure to do so, however, does not require a reversal in this case. The trial court had numerous contacts with defendant prior to trial, including a hearing on his custodial conditions, and commented on his ability to express himself and participate in the proceedings. We find sufficient evidence in the entire record from which the trial court could have determined that defendant's waiver was voluntarily and intelligently made.
2. Next, defendant contends that Minn.St. 243.55[3] does not apply to the Minnesota Security Hospital because it is not a correctional institution. The statutory language is not limited to correctional institutions; rather, the statute prohibits the introduction of contraband into "the state prison or the state reformatory or any other state institution."[4] (Emphasis added.) In Salisbury v. State Dept. of Social Security, 220 Minn. 517, 20 N.W.2d 349 (1945), a state *891 employee was injured while shooting pigeons on the grounds of the State School for the Feeble Minded at Faribault. The state attempted to avoid liability for workers compensation benefits by claiming the employee had violated Minn.St. 640.16 (1941).[5] We did not question the statute's applicability to that institution but found no violation, because the Director of Public Institutions had consented to the shooting.
In the instant case we hold that the Minnesota Security Hospital is a state institution within the meaning of § 243.55.
3. Defendant's argument that the June 4 search of his cell violated the Fourth Amendment because it was conducted without a search warrant or probable cause is without merit. Searches in correctional institutions are permitted without search warrants or probable cause when necessary to maintain security. See, State v. Pietraszewski, 285 Minn. 212, 172 N.W.2d 758 (1969). A person in custody has, of necessity, a diminished expectation of privacy in his cell. See, Lanza v. New York, 370 U.S. 139, 82 S.Ct. 1218, 8 L.Ed.2d 384 (1962); State v. Riley, 303 Minn. 251, 226 N.W.2d 907 (1975). The Minnesota Security Hospital, although not a correctional institution per se, contains persons convicted of crimes who are adjudged mentally ill, as well as persons committed as mentally ill and dangerous. The security risks are just as great there as in a correctional institution. In addition, residents have no reasonable expectation of privacy in the common areas of their cells. Thus, searches in the Minnesota Security Hospital may be conducted without a warrant or probable cause when necessary to ensure security.
4. Defendant contends that the trial court erred in not excluding testimony of two witnesses whose names were not disclosed prior to trial pursuant to Rule 9.01, subd. 1(1)(a), Minnesota Rules of Criminal Procedure. This rule requires the prosecutor to disclose the names of all witnesses he intends to call at trial. The sanctions to be applied for failure to disclose are within the discretion of the trial court. See, Rule 9.03, subd. 8. The trial court did not abuse its discretion by not excluding the testimony in the instant case.[6] The testimony was important because it established that neither defendant nor Lausche had consent to bring the gun into the hospital and that defendant had the opportunity to receive the gun from Lausche before he was apprehended. Furthermore, the prosecutor's failure to disclose was inadvertent, and defendant did not request a continuance to prepare for cross-examination.
5. Defendant also challenges the sufficiency of the evidence to sustain his conviction. His main contention is that Hess was an accomplice and that without his testimony the testimony of Lausche, the admitted accomplice, was not sufficiently *892 corroborated.[7] An accomplice is one who can be indicted and convicted for the crime with which the defendant is charged. An accessory after the fact is not an accomplice. State v. Swyningan, 304 Minn. 552, 229 N.W.2d 29 (1975); State v. Matousek, 287 Minn. 344, 178 N.W.2d 604 (1970). In the instant case there is no evidence that Hess had any involvement with the crime before he hid the gun and ammunition. At most he can be considered an accessory after the fact. Hess' testimony, as well as that of defendant himself, corroborated Lausche's testimony and implicated defendant in the crime. Thus, there is sufficient evidence to sustain defendant's conviction.
6. Defendant's remaining challenges to evidentiary rulings of the trial court have been carefully examined and found to be without merit.
Affirmed.
NOTES
[1]  Lausche later turned himself in to the police and pled guilty to violating Minn.St. 243.55.
[2]  At the Initial Appearance on June 13, 1977, defendant complained of the physical conditions under which he was being held. He then filed a petition for writ of habeas corpus, and the trial court ordered the hospital to clean the cell, to allow defendant regular exercise, and to permit reasonable visitation. At sentencing defendant claimed that although the cell had been cleaned, he was still allowed only limited visitation and exercise.
[3]  Minn.St. 243.55 provides:

"Any person who brings, sends, or in any manner causes to be introduced into the state prison or the state reformatory or any other state institution, or within or upon the grounds belonging to or land or controlled by any such institution, any controlled substance as defined in section 152.01, subdivision 4, or any intoxicating liquor of any kind whatever, or any firearms, weapons or explosives of any kind, without the consent of the warden or superintendent thereof, shall be guilty of a felony; and, upon conviction thereof, punished by imprisonment in the state prison for a term of not less than three, nor more than five, years; provided, that the provisions of this section shall not apply to physicians carrying drugs into such institutions for use in the practice of their profession; nor to sheriffs or other peace officers carrying revolvers or firearms as such officers in the discharge of duties."
[4]  The history of Minn.St. 243.55 indicates that the Minnesota Security Hospital is a state institution within the meaning of that statute. In 1923, the phrase "any other state institution" was added to the statute, and the term "the state board of control" was substituted for "the warden or superintendent" as the consenting party. L.1923, c. 391 § 1; Gen.Stat. § 10803 (1923). The State Board of Control managed:

"* * * the state prison, state reformatory, state training school for boys and girls, the school for the feeble-minded, the state hospital asylums for the insane, the state school for the blind, the state school for the deaf, the state public school for dependent children, the state hospital for indigent, crippled and deformed children, the state hospital for inebriates and except as otherwise provided by law, the state sanitorium for consumptives, the home school for girls and the state reformatory for women * * *." Gen.Stat. 4401 (1923).
Subsequent amendments altered the party who managed these institutions and the consenting party. In 1959, the legislature created the Department of Corrections and transferred those powers and duties of the Commissioner of Public Welfare relating to the prisons and reformatories to the Commissioner of Corrections. L.1959, c. 263 §§ 1, 2. Although state hospitals remained under the control of the Department of Public Welfare, there was no indication that the legislature intended to exclude them from § 243.55.
The 1979 legislature amended § 243.55 to read:
"Any person who brings, sends, or in any manner causes to be introduced into any state correctional facility * * *, any controlled substance or any firearms, weapons or explosives of any kind, without the consent of the chief executive officer thereof, shall be guilty of a felony * * *." (Emphasis added.) 1979 Minn.Sess. Laws Serv. (West) c. 102 § 6.
This amendment, which is effective August 1, 1979, see Minn.St. 645.02, does not control the decision in this case.
[5]  The statute was later renumbered as Minn.St. 243.55. See, Minn.St.1961, § 640.16.
[6]  State v. Chamberlain, No. 46282 (1975), reported only in 7 Minnesota Practice § 464, does not require exclusion of the testimony in this case. In that case we upheld the exclusion of the defendant's alibi witnesses because he intentionally and deliberately refused to disclose their names prior to trial.
[7]  Lausche's testimony alone could not be used to convict defendant. See, Minn.St. 634.04, which provides: "A conviction cannot be had upon the testimony of an accomplice, unless it is corroborated by such other evidence as tends to convict the defendant of the commission of the offense, and the corroboration is not sufficient if it merely shows the commission of the offense or the circumstances thereof."

Corroboration need not establish a prima facie case but is sufficient if it restores confidence in the accomplice's testimony, confirming its truth and pointing to a defendant's guilt in some substantial degree. State v. Houle, 257 N.W.2d 320 (Minn.1977).
