
731 A.2d 863 (1999)
1999 ME 104
Lawrence A. NADEAU et al.
v.
John P. PITMAN et al.
Supreme Judicial Court of Maine.
Argued June 7, 1999.
Decided June 30, 1999.
*864 Joel C. Martin (orally), Petruccelli & Martin, LLP, Portland, for plaintiffs.
Jennifer Nichols Ferguson, Anthony K. Ferguson (orally), Fales & Fales, P.A., Lewiston, for defendants.
Before WATHEN, C.J., and RUDMAN, DANA, ALEXANDER, and CALKINS, JJ.
ALEXANDER, J.
[¶ 1] John P. Pitman, M.D., and Taylor, Pitman & Eule Radiology Professional Associates, P.A., (collectively the "defendants") appeal from a judgment entered in the Superior Court (Cumberland County, Brennan, J.) concluding that the defendants were unjustly enriched by a refund of insurance charges and ordering Pitman and Mark M. Eule, M.D.[1] to share the refund equally with former stockholders, Lawrence A. Nadeau, M.D., and Richard W. Taylor, M.D. (collectively the "plaintiffs"). The defendants argue that the court erred in (1) applying the law of unjust enrichment because there were contracts that governed the issue; (2) concluding that the defendants were unjustly enriched; and (3) concluding that defendant Pitman was individually liable. We conclude that a contract governed the financial arrangements between the parties, barring application of the unjust enrichment doctrine. Accordingly, we vacate the judgment.
[¶ 2] In 1974, Taylor, Pitman, Nadeau and another physician, John Konecki formed a professional services corporation,[2] later known as Radiology Professional Associates, P.A. (RPA), under which they conducted their radiology practice.[3] Konecki died in August 1976. Eule joined the practice in 1977 and became a stockholder in the corporation in 1978. The court found that "[t]hroughout the time these doctors worked together they shared equally the benefits and burdens of their practice." As such, they "were equal partners in this enterprise." From 1976 to 1981, RPA purchased its medical malpractice insurance from Maine Medical and Hospital Malpractice Joint Underwriting Association (JUA).[4]
*865 [¶ 3] In January 1978, as equal shareholders in the corporation, Taylor, Pitman, Nadeau and Eule entered into a stock purchase agreement. The agreement included the following formula by which the corporation would redeem the value of a stockholder's shares when a stockholder terminated his relationship with the corporation:
The purchase price for the shares of stock of a deceased, disabled or retired stockholder shall be the book value thereof, determined as set forth below as of the close of the books of the corporation as of the last day of the month preceding such death, disability or retirement.
The purchase price of each share of common stock shall be determined by the following formula. Net worth as shown on books of corporation less accounts receivable and less all unrecorded liabilities as of immediately prior to such death, disability or retirement. The total value of all shares of common stock as found by way of the foregoing formula shall be divided by the total number of shares of common stock outstanding, and thus the value of each share shall be ascertained.
Book value shall be determined by the accountant servicing the corporation in accordance with generally accepted accounting principles. Notwithstanding the foregoing, however, should the fair market value of any assets of the corporation be greater than the amount carried on the corporate books, then the fair market shall be used in computing the value for these purposes.
[¶ 4] In 1986, Nadeau retired from RPA. The shareholders and RPA entered into a redemption agreement setting forth Nadeau's retirement compensation. In return for his fifty shares, RPA agreed to pay Nadeau $80,000 over two years with interest. The payment was calculated according to the 1978 stock purchase agreement.
[¶ 5] RPA's principal asset was its accounts receivable. RPA's accountant calculated the payment to Nadeau by determining the gross accounts receivable and then calculating how much of that total was likely to be collected after discounting for payments by third parties such as Medicare and Medicaid. The accountant then divided the accounts receivable by four and added unused vacation and sick time. When calculating the payment, the accountant did not consider the potential of a refund from the JUA.
[¶ 6] The redemption agreement with Nadeau provided that,
Seller acknowledges that upon payment of the Note attached hereto in accordance with its terms, that Seller will have received full and complete satisfaction of all duties and obligations of Purchaser to him under [the 1978 stock purchase agreement], and does hereby release all other claims against Purchaser.
[¶ 7] In 1987, in accordance with 24 M.R.S.A. § 2406(5), JUA issued a check for $33,363.17 to RPA as a refund of stabilization reserve fund charges paid from 1976 to 1981 plus interest. Even though Nadeau had already retired by the time *866 the check arrived, Taylor, Pitman, Eule, and Nadeau shared the refund equally.[5]
[¶ 8] In 1991, Taylor retired from RPA. Pursuant to the 1978 contract, he received $60,000 in exchange for his shares in the corporation. Twenty-thousand dollars of this sum was placed in an escrow account as a contribution to the potential settlement of a suit then pending against RPA by a former RPA employee.[6] Taylor's payment was calculated in the same way as Nadeau's, but apparently there was no separate written redemption agreement. Again, the accountant did not consider a potential refund from JUA in calculating the payment.
[¶ 9] In August 1995, JUA made a final distribution of its surplus in the stabilization reserve fund, and RPA received a check for $62,301.18.[7] After some communication among the four doctors, Pitman and Eule decided not to share the refund.
[¶ 10] In October 1996, Nadeau and Taylor filed a complaint alleging that the defendants had breached an express and implied contract to share the refund and that the defendants had been unjustly enriched by retaining the 1991 refund. The court granted defendants' motion for a summary judgment on the express and implied contract claims due to a lack of consideration.
[¶ 11] After a nonjury trial, the Superior Court determined that the 1978 contract under which the value of Nadeau's and Taylor's retirement payments had been determined was affected by a mistake of fact because it did not consider the potential for distribution of excess stabilization reserve fund charges from JUA. The court determined:
. . . that at the time Dr. Nadeau, and later Dr. Taylor, entered into the stock repurchase agreements all parties labored under the same misconception of a material fact. Specifically, that the Corporation had a significant contingent asset, a potential refund of insurance premiums in excess of $60,000. This asset was very much like the accounts receivable which Mr. Richards testified were the key to his valuation. It was totally ignored when the shares were repurchased although it was fully paid in before either doctor retired. This mutual mistake of fact renders the contracts unenforceable and permits an equitable remedy, if Plaintiffs can establish their claims of unjust enrichment.
[¶ 12] In supplemental findings, the court stated that, "[t]he mutual mistake of fact occurred at the time of performance under the stock purchase agreement." The court noted that "under these circumstances, the 1981[8] stock purchase agreement should not bar the equitable relief sought by plaintiffs."
[¶ 13] In its findings the trial court appeared to determine that while the mutual mistake occurred at the time of calculation and performance under the stock purchase agreement, those mistakes served to void the effect of the 1978 agreement. With the 1978 agreement ruled ineffective, the court applied the doctrine of unjust enrichment to require that the 1995 distribution from JUA be split evenly among Pitman, Eule, Nadeau and Taylor. The defendants filed a timely appeal from the court's judgment.
[¶ 14] The remedy of "[u]njust enrichment describes recovery for the value *867 of the benefit retained when there is no contractual relationship, but when, on the grounds of fairness and justice, the law compels performance of a legal and moral duty to pay." Paffhausen v. Balano, 1998 ME 47, ¶ 6, 708 A.2d 269, 271. The existence of a contractual relationship, "precludes recovery on a theory of unjust enrichment." June Roberts Agency, Inc. v. Venture Properties, Inc., 676 A.2d 46, 49 n. 1 (Me.1996).
[¶ 15] As a matter of law, the mistake of fact which the Superior Court foundthe failure to consider the potential for return of funds from JUA, at the 1986 and 1991 times of performance under the 1978 agreementcould not void the 1978 agreement. There may be other remedies available for accounting errors or mistakes in calculations in the performance of an agreement, but such errors are not a mutual mistake of fact which voids the earlier agreement and justifies application of the doctrine of unjust enrichment to cure errors in performance of a valid agreement.
[¶ 16] The stock purchase agreement and the repurchase formula were developed in 1978. The law then in effect recognized the possibility of return of any overpayments of stabilization reserve fund charges being paid to JUA. See 24 M.R.S.A. § 2406(5). A mutual mistake of fact to undermine the validity of a contract must exist at the time of entry of the contract. Miller v. Lentine, 495 A.2d 1229, 1231 (Me.1985). Events which occur subsequent to execution of a contract and are not contemplated by the parties at the time of execution of the contract, are not a mutual mistake rendering a contract unenforceable. Dufort v. Bangs, 644 A.2d 6, 7 (Me.1994); Bouchard v. Blunt, 579 A.2d 261, 263 (Me.1990). If mutual mistakes of fact which could void contracts were interpreted as any error in performance or change in expectations after entry of a contract, then all contracts could be undermined on mutual mistake of fact theory.
[¶ 17] The decision of the JUA reached sometime in the 1980's to begin repayments to policyholders of proceeds in the stabilization reserve fund could not be a mistake of fact undermining a contract entered in 1978. Because the termination of the parties' financial relationship was governed by a valid contract, the unjust enrichment theory could not be applied to require readjustment of the retirement pay amounts for contingent benefits not calculated in determining corporate value at the time of retirement, and coming to the corporation after the time of retirement.
[¶ 18] Because we conclude that the court erred in applying the unjust enrichment remedy, we need not address defendants' other contentions.
The entry is:
Judgment vacated. Remanded to the Superior Court with direction to enter judgment for the defendants.
NOTES
[1]  Dr. Eule was an original named defendant and a party to this appeal, however, he was dismissed from this action prior to oral argument.
[2]  Pursuant to 13 M.R.S.A. § 705 (Supp.1998),

[a]n individual or group of individuals duly licensed or otherwise legally authorized to render the same professional service within this State may organize and become a shareholder or shareholders of a professional corporation under the corporation laws for the sole and specific purpose of rendering the same and specific professional service.
[3]  Apparently RPA's corporate status was suspended on June 14, 1995, pursuant to 13-A M.R.S.A. § 1302 (Supp.1998) for failing to file an annual report with the Secretary of State. At oral argument it was indicated that the corporation has no effective existence.
[4]  In 1975, the Legislature enacted the Maine Medical and Hospital Malpractice Joint Underwriting Association Act. See P.L.1975, ch. 442, repealed by P.L.1995, ch. 311, § 1. In order "to provide, until July 1, 1981, a market for medical malpractice insurance on a self-supporting basis without subsidy from its members" the Act created a temporary Joint Underwriting Association. 24 M.R.S.A. § 2403(2). Any insurer who had assets of $5,000,000 or more and who was "authorized to write and engage in writing, within this State on a direct basis, personal injury liability insurance" was required to be a member of the JUA. Id. § 2403(1). Once the superintendent had determined that medical malpractice insurance could not "be made readily available for physicians in the voluntary market," the JUA could commence underwriting operations for physicians. Id. § 2403(3). The JUA had "the power, on behalf of its members, to issue or to cause to be issued, policies of insurance to applicants . . . to underwrite such insurance and to adjust and pay losses with respect thereto or to appoint service companies to perform those functions, to assume reinsurance from its members and to cede reinsurance." Id. § 2403(4).

In order to ensure the solvency of the JUA, the Act also created a "stabilization reserve fund." Id. § 2406. Each policyholder was required to "pay to the association a stabilization reserve fund charge equal to 1/3 of each premium payment for the insurance through the association." Id. § 2406(3). If a policyholder failed to pay the reserve fund charge, the association would cancel the policy. Id. The moneys received by the fund were to be "held in trust by a corporate trustee of a bank or trust company." Id. § 2406(5). The moneys held in trust were to be used "solely for the purpose of discharging when due any retrospective premium charges payable by policyholders of the association under the group retrospective rating plan authorized by [the Act]." Id. Any funds remaining after payment of all premium charges were to "be returned to policyholders under procedures authorized by the directors." Id.
[5]  The doctors may have shared some of the refund with the widow of Dr. Konecki.
[6]  The suit later settled for $171,000. Taylor did not contribute any more than the $20,000 in escrow.
[7]  P.L.1995, ch. 311, § 2 repealed 24 M.R.S.A. §§ 2401-14, authorized the JUA "to wind up its affairs," and ratified "the distribution of the net surplus of the joint underwriting association." 24 M.R.S.A. §§ 2401-14 (Pamph. 1998).
[8]  The 1981 reference is unclear. Since there was no separate redemption agreement when Taylor retired in 1991, the only agreement governing valuation of his shares was the 1978 stock purchase agreement.
