Braley, J.
By the terms of the contract in its present form no invalidity appears, and both principal and agent could be held by the defendant for the performance of the promise. The plaintiff, if an agent, would be liable because of an unrestricted undertaking to perform, while The Bruce-Merriam-Abbott Company, which is referred to as its principal, could be reached, because oral evidence might be introduced to prove that it was the real party in interest. Brown v. Bradlee, 156 Mass. 28. Crawford v. Moran, 168 Mass. 446, 449. The plaintiff having been sued at law for an alleged breach, unless it pleads an equitable defence under R. L. c. 173, § 28, is precluded at the trial from introducing extrinsic evidence to prove in defense that, by mutual mistake as to the parties to be bound, the written instrument embodied a different contract from that which they actually made. Tucker Manuf. Co. v. Fairbanks, 98 Mass. 101, 104. Instead, however, of invoking the aid of the statute for defensive relief, it has elected the concurrent remedy of a bill in equity. Barton v. Radclyffe, 149 Mass. 275, 280. Page v. Higgins, 150 Mass. 27, 28. Nathan v. Nathan, 166 Mass. 294.
But, while the objection of the adequacy of the remedy at law is not well taken, there remain the other questions raised, that either a case for equitable relief has not been stated, or, if stated, appropriate relief cannot be decreed for want of necessary parties. The uncertainty as to the intention of the parties, which often arises from conflicting evidence where the reformation of a bilateral contract is sought upon the ground of mistake, is eliminated, as all the allegations of the bill are admitted by the demurrer. Upon an examination of them, it is manifest that the parties to the contract were intended to be the defendant and The Bruce-Merriam-Abbott Company. In the preliminary negotiations, as well as at the time of acceptance and execution, the defendant was fully informed of the representative capacity in which the plaintiff acted, and also knew that it neither manufactured engines nor *218possessed facilities for making the required tests called for by the contract, and did. not intend to incur any contractual liability, but only to act in behalf of its principal. With full knowledge of the facts by all concerned, it was mutually understood that plans were to be prepared, the engine built and delivered, and its capacity and mechanical excellence in operation guaranteed by the manufacturer, who was the vendor and to whom the purchase price was to be paid. Both sides are thus placed unequivocally in a position where they had come to a full understanding of the terms of a sale, which, through mutual misconception, their written agreement does not fully express. It is claimed that in many particulars the engine failed to correspond with the warranty, and that, unless the plaintiff is relieved, it may be liable in damages to the defendant. If this result follows, the defendant, although fully cognizant of their mutual error, which it refuses to correct, would obtain an unconscientious advantage over the plaintiff, which originally neither intended. If the claim is not established, even then the plaintiff is exposed to the expense and vexation of litigation to which it has been subjected by the defendant’s conduct. The power of a court of equity to reform the writing to express the contract upon which they agreed is denied by the defendant upon the sole ground that the mistake was not an error of fact, but of law. But, while the parties correctly understood the subject matter and principal purpose of the contract, they were subject to a mutual mistake, when using and filling in the printed form, as to the antecedent legal rights and liabilities of the plaintiff. They had come to an agreement which would have been correctly set forth but for the misapprehension of the plaintiff, by whom apparently it was prepared, as to the effect upon its liability of the language employed, the plaintiff also mistaking the proper form of signature as an execution of the contract by which its principal, rather than itself, would become bound. Their error constituted a mistake of fact, from which equity will grant relief by a reformation of the instrument to conform to the actual bargain which the parties made but failed to express. Canedy v. Marcy, 13 Gray, 373. Stockbridge Iron Co. v. Hudson Iron Co. 107 Mass. 290, 319. Page v. Higgins, 150 Mass. 27, 30, 31. Goode v. Riley, 153 Mass. *219585. Murphy v. Livingstone, 187 Mass. 315. DeFriest v. Bradley, 192 Mass. 346, 353. Eastman v. Provident Relief Association, 65 N. H. 176. Woodbury Savings Bank & Building Association v. Charter Oak Ins. Co. 31 Conn. 517,529. Griswold v. Hazard, 141 U. S. 260. Stapylton v. Scott, 13 Ves. 425. Beauchamp v. Winn, L. R. 6 H. L. 223, 233, 234. 1 Story Eq. Jur. (13th ed. by Bigelow) § 111, note a, § 140, note a, and cases cited. 2 Pom. Eq. Jur. (3d ed.) §§ 858, 849, and cases cited. In the application of this principle, mistakes as to title have been corrected, the word “ heirs ” substituted for “ successors,” omission of words of inheritance supplied, a deed reformed to bind a copartnership instead of an individual member, a mortgage in the name of an agent rectified by inserting the name of the principal as mortgagor, and the principal substituted for a trustee who had been mistakenly designated and had bound himself as a contracting party. Murphy v. Livingstone, ubi supra. Hadlock v. Williams, 10 Vt. 570. Denys v. Shuckburgh, 4 Y. & C. 42. Colchester v. Culver, 29 Vt. 111. McNaughten v. Partridge, 11 Ohio, 223. Remington v. Higgins, 54 Cal. 620. Blakeman v. Blakeman, 39 Conn. 320. Haussman v. Burnham, 59 Conn. 117. Sparta v. Mendell, 138 Ind. 188. It is to be inferred from the record that the contract has been fully executed, but this does not prevent suitable relief. If reformation is decreed, the defendant is not deprived of any right, but still has its alleged cause of action against the party who alone should be chargeable in damages for any failure to comply with the warranty. Long v. Athol, 196 Mass. 497. Harrison v. Talbot, 2 Dana, 258. Paine v. Upton, 87 N. Y. 327. 1 Story Eq. Jur. (13th ed. by Bigelow) § 159.
If, however, the plaintiff is entitled to relief in some form upon proof of the averments of the bill, we are asked to say that it cannot be administered unless The Bruce-Merriam-Abbott Company, a foreign corporation, is joined as a party. In equity the general rule is that all persons having a material interest in the subject matter of the suit must be made parties. But, having been introduced for the purpose of justice, the rule will not be applied to accomplish its defeat, if, consistently with the merits of the case, the court can proceed to a decree as to the parties before it, even if other persons, who may be interested *220but over whom it does not possess jurisdiction, are absent. Upon an elaborate review of the authorities by Judge Story in West v. Randall, 2 Mason, 181, 190, 193, he says, “ whenever, therefore, the party supposed to be materially interested is without the jurisdiction of the court . . . the court will not insist upon the objection; but, if it can, will proceed to make a decree between the parties before the court, since it is obvious, that the case cannot be made better. ” After full consideration, this modification of the general rule was recognized, approved and followed, in the case of Florence Sewing Machine Co. v. Grover & Baker Sewing Machine Co. 110 Mass. 1, 8, 9, where one of the grounds of demurrer was that certain foreign corporations, who were joint licensors with the defendant, had not been joined. It is sufficient if this excuse for the non-joinder of parties appears generally from the bill without being specifically pleaded. Palmer v. Stevens, 100 Mass. 461, 466. The provisions of St. 1903, c. 437, § 58, relating to the service of writs upon foreign corporations doing business in this Commonwealth, being inapplicable, if the corporation were made a party it would not be concluded by a decree, unless, after being served with process within this jurisdiction, it appeared. Florence Sewing Machine Co. v. Grover & Baker Sewing Machine Co., ubi supra. Under these circumstances the plaintiff should not be left remediless. It is not in the situation of a party asking for affirmative relief, where, upon reformation being ordered, the bill could be retained for the assessment of damages, as in Butler v. Barnes, 60 Conn. 170, 190. But the right to be relieved rests upon the ground that, while the defendant is entitled to the benefit of the contract which the parties intended to make and supposed they had made, it would be inequitable and unjust to permit the enforcement at law of an agreement which, if reformed in accordance with their intention, would relieve the plaintiff from all liability. See Dehon v. Foster, 4 Allen, 545, 550, 551.
The court not being limited to one form of remedy, even if it should decline to rectify the contract because of the absence of a party who, if within its jurisdiction and served with process, upon rectification would become bound to its performance, may enjoin the defendant from making a wrongful use of the instrument to the damage of the plaintiff. Tompson v. National *221Bank of Redemption, 106 Mass. 128. Florence Sewing Machine Co. v. Grover & Baker Sewing Machine Co., ubi supra, p. 12. 2 Daniel, Ch. Pl. & Pr. (6th Am. ed.) § 1623. Field v. Cory, 3 Halst. Ch. 574. It must be left to the Superior Court, when put in possession of the merits of the controversy, to decide as to the measure of relief which should be granted.
But, while the plaintiff has stated a case for equitable relief, we are of opinion that, as matter of practice, the plaintiff should amend by joining the non-resident corporation as a party, and make such service upon it as may be ordered under the fifth equity rule. If the corporation does not appear, or if it appears and moves to dismiss for want of jurisdiction, then, for the reasons stated, the court has jurisdiction to administer appropriate relief as between the present parties. Hildreth v. Thibodeau, 186 Mass. 83, 84.
The decree dismissing the bill must be reversed and a decree entered sustaining the demurrer for want of parties, with leave to the plaintiff to amend its bill by joining The Bruce-Merriam-Abbott Company as a party defendant.
Ordered accordingly.