
167 Ill. App.3d 758 (1988)
521 N.E.2d 1243
CATHERINE L. HAUK et al., Plaintiffs-Appellees,
v.
JOHN H. DAY et al., Defendants-Appellants.
Nos. 3-87-0278, 3-87-0279 cons.
Illinois Appellate Court  Third District.
Opinion filed April 5, 1988.
*759 Murvel Pretorius, Jr., of Quinn, Johnston, Henderson & Pretorius, and Kevin M. Miller, of Goldsworthy, Fifield & Hasselberg, both of Peoria (Karen Kendall and Paul Gilfillan, of counsel), for appellant John H. Day.
Gary M. Peplow and Elizabeth W. Christensen, both of Heyl, Royster, Voelker & Allen, of Peoria, for appellant Narendra K. Gupta.
Raymond C. Rose, of Raymond C. Rose, Ltd., James E. Shadid, and Cusack & Fleming, P.C., all of Peoria (Michael A. Fleming, of counsel), for appellees.
Judgment affirmed.
JUSTICE STOUDER delivered the opinion of the court:
The plaintiffs, Catherine L. Hauk and Jeffery Hauk, filed a complaint against the defendants, John H. Day and Narenda K. Gupta, alleging medical negligence. Pursuant to the healing art malpractice provision (Ill. Rev. Stat. 1985, ch. 110, par. 2-622), the plaintiffs attached an affidavit to the complaint stating that the statute of limitations was about to run and that the plaintiffs were availing themselves of the additional 90-day extension provided by the statute to have the case reviewed by an appropriate health care professional.
The plaintiffs did not file an affidavit of a health care professional until 12 days after the 90-day extension period expired. Both defendants filed motions to dismiss the complaint pursuant to section 2-619 of the Illinois Code of Civil Procedure (Ill. Rev. Stat. 1985, ch. 110, par. 2-619), based upon the plaintiffs' failure to comply with the provisions *760 of section 2-622.
The trial court denied the defendants' motion to dismiss and allowed the plaintiffs leave to file the physician's affidavit beyond the 90-day time period. The defendants have appealed pursuant to Supreme Court Rule 308 (107 Ill.2d R. 308).
Previously, we decided in favor of the defendants and reversed the trial court. However, the plaintiffs filed a petition for rehearing which called our attention to the Illinois Supreme Court case of McCastle v. Sheinkop (1987), 121 Ill.2d 188. McCastle was decided after we had issued our previous decision. After withdrawing the previous opinion and giving both parties an opportunity to brief their respective positions in light of McCastle, we now affirm the decision of the trial court.
On appeal, the defendants contend that the trial court erred by allowing the plaintiffs to file an affidavit of merit and physician's report after the 90-day period had expired.
 1 Section 2-622 states, in pertinent part, that when an action is filed seeking damages for medical malpractice:


   "[P]laintiff's attorney or the plaintiff * * * shall
   file an affidavit, attached to the original and all
   copies of the complaint, declaring one of the
   following:
         1. That the affiant has consulted and reviewed
      the facts of the case with a health professional
      who the affiant reasonably believes is
      knowledgeable in the relevant issues involved * *
      *; that the reviewing health professional has
      determined in a written report * * * that there
      is a reasonable and meritorious cause for the
      filing of such action; and that the affiant has
      concluded on the basis of the * * * review and
      consultation that there is a reasonable and
      meritorious cause for filing of such action. * *
      *
         [or]
         2. That the affiant was unable to obtain a
      consultation required by paragraph 1 because a
      statute of limitations would impair the action
      and the consultation required could not be
      obtained before the expiration of the statute of
      limitations. If an affidavit is executed pursuant
      to this paragraph, the certificate and written
      report required by paragraph 1 shall be filed
      within 90 days after the filing of the complaint.
                   *   *   *
         (g) The failure to file a certificate required
      by this Section shall be grounds for dismissal
      under Section 2-619. [Ill. Rev. Stat. 1985, ch.
      110, par. 2-619.]" Ill. Rev. Stat. 1985, ch. 110,
      par. 2-622.

*761 The purpose of section 2-622 is to deter medical malpractice plaintiff's from filing frivolous or nonmeritorious lawsuits. (See generally Ill. Ann. Stat., ch. 110, pars. 2-109, 2-622, Historical and Practice Notes (Smith-Hurd Supp. 1987).) Section 2-622(g) specifically provides that the failure to file the certificate required by section 2-622(a) shall be grounds for involuntary dismissal under section 2-619.
 2 The plaintiffs contend, and we agree, that this case is governed by McCastle v. Sheinkop (1987), 121 Ill.2d 188. In McCastle, the plaintiff, James McCastle, filed a medical malpractice action against the defendants, Mitchell Sheinkop, M.D., and Rush-Presbyterian-St. Luke's Medical Center. Thereafter, defendants filed motions to dismiss for failure to attach to the complaint the attorney's affidavit and health professional's report as required by section 2-622 of the Code of Civil Procedure (Ill. Rev. Stat. 1985, ch. 110, par. 2-622). The trial court granted the defendants' motions and dismissed the cause with prejudice. The Illinois Supreme Court vacated the trial court's order and remanded the cause for further consideration. In remanding the cause, the court stated that section 2-622 does not require dismissal with prejudice if affidavits are not timely filed and that the trial court has discretion to allow late filing of the affidavit as an amendment to the complaint. McCastle v. Sheinkop (1987), 121 Ill.2d 188.
 3 McCastle also states that interpreting section 2-622 to automatically require dismissal with prejudice for failure to file an affidavit
"would be a triumph of form over substance. It would elevate a pleading requirement designed to reduce frivolous lawsuits into a substantive defense forever barring plaintiffs who initially fail to comply with its terms. We decline to ascribe such intentions to the legislature." (McCastle v. Sheinkop (1987), 121 Ill.2d 188, 193.)
The holding in McCastle illustrates that the trial court has discretion to allow the late filing of an affidavit and/or certificate, whether after the filing of the complaint or after the expiration of the 90-day period where applicable. Thus, the trial court's decision in this case is upheld as a proper exercise of discretion.
For the foregoing reasons the judgment of the circuit court of Fulton County is affirmed.
Affirmed.
BARRY, P.J., and HEIPLE, J., concur.
