After a fire which seriously damaged the house of the defendants, they made on May 16, 1935, a written contract with the plaintiffs for labor and materials in the repair and enlargement of the house. The price stated in the contract was $4,475, but afterwards on the same day an oral modification of the contract was made which eliminated much of the work and reduced the price to $3,030.' A memorandum of the change was made and signed by the plaintiffs, but the defendants never signed it. The agreed modification must be deemed oral, not written.
As the work progressed, changes in the mode of performance called for by the written contract were made by oral agreement. For example, the dimensions of an addition had to be changed to comply with the building laws. Various extras were ordered by the defendants, and on August 19, 1935, they agreed in writing to pay $1,119 for them.
The master finds: “The contract as modified from time to time by oral agreement between the parties was fully and completely performed by the plaintiffs and ... all of the labor performed and materials furnished under said modified contract were performed and furnished after the *37notice of the contract had been filed in the registry of deeds” on June 4, 1935.
Under the present mechanic’s lien law, St. 1915, c. 292, now G. L. (Ter. Ed.) c. 254, apart from small claims for personal labor (§ 1), there can be no such lien except for “labor and material . . . furnished by virtue of” a written contract. §§ 2, 4. Savoie Quarry & Construction Co. v. Ziman, 234 Mass. 210, 213. Adams & Powers Co. v. Seder, 257 Mass. 453. Katauskas v. Lonstein, 266 Mass. 29. See also Glazer v. Schwartz, 276 Mass. 54. Moreover, a contractor with the owner can have no lien except for labor and material furnished after notice of the written contract has been filed or recorded in the registry of deeds. § 2. The special commission which reported and recommended the legislation of 1915 said (1915 House Doc. No. 1600, page 12), “The whole tendency of the law in its every branch, as business methods have developed and become more complicated, has been toward the exclusion of oral contracts involving uncertainty, dispute and probable litigation, and in favor of written instruments and public notice by means of the public records.” We have to consider whether the work for which a lien is claimed was done by virtue of a written contract and after the filing or recording of notice of that contract.
In the absence of a statute which, like the statute of frauds, requires a contract to be written or evidenced by writing, a valid contract may be partly written and partly oral. MacLaren v. Windram Manuf. Co. 287 Mass. 221, 227. Montuori v. Bailen, 290 Mass. 72, 74. Povey v. Colonial Beacon Oil Co. 294 Mass. 86, 91. Kesslen Shoe Co. Inc. v. Philadelphia Fire & Marine Ins. Co. 295 Mass. 123 (partial reduction to writing). Cummings v. Arnold, 3 Met. 486, 489. Emery v. Boston Marine Ins. Co. 138 Mass. 398, 412. Torrey v. Adams, 254 Mass. 22. Martiniello v. Bamel, 255 Mass. 25. Kirkley v. F. H. Roberts Co. 268 Mass. 246, 252, 253. McCormick v. Proprietors of the Cemetery of Mount Auburn, 285 Mass. 548, 550. Williston, Contracts (Rev. Ed.) § 591 (oral modification of written contract). Even a sealed contract may *38be modified orally. Hastings v. Lovejoy, 140 Mass. 261, 265. Tuson v. Crosby, 172 Mass. 478, 484. Commonwealth Investment Co. v. Fellsway Motor Mart, Inc. 294 Mass. 306. Am. Law Inst. Restatement: Contracts, § 407.
But a contract partly oral does not meet the requirement of writing under the statute of frauds. Wiessner v. Ayer, 176 Mass. 425. Rosenfeld v. Standard Bottling & Extracts Co. 232 Mass. 239, 245. Dutton v. Bennett, 256 Mass. 397, 403. Rosenfield v. United States Trust Co. 290 Mass. 210. Saco-Lowell Shops v. Clinton Mills Co. 277 Fed. 349. The general rule is that an oral modification (not a rescission, Williston, Contracts [Rev. Ed.] § 592) of a written contract which originally was and as modified is within the statute of frauds, cannot be wholly or in part the foundation of an action. Cummings v. Arnold, 3 Met. 486, 491-492, 493. Whittier v. Dana, 10 Allen, 326, 328. Williston, Contracts (Rev. Ed.) § 593. Exceptions to this rule have been made on the ground of estoppel. Stearns v. Hall, 9 Cush. 31. Imperator Realty Co. Inc. v. Tull, 228 N. Y. 447. M. H. Metal Products Corp. v. April, 251 N. Y. 146, 150. Swain v. Seamens, 9 Wall. 254, 273, 274. Warren v. Dodge, 83 N. H. 47. Zannis v. Freud Hotel Co. 256 Mich. 578. Williston, Contracts (Rev. Ed.) §§ 533A, 593. Am. Law Inst. Restatement: Contracts, § 224. In this Commonwealth some effect has been given to an oral agreement varying the mode of performance of a written contract within the statute of frauds, although no action has been permitted unless founded on the written contract alone. The theory has been well stated by Hoar, J., in Whittier v. Dana, 10 Allen, 326, citing Cummings v. Arnold, 3 Met. 486, the leading case. See also King v. Faist, 161 Mass. 449, 456, 457; Freedman v. Gordon, 220 Mass. 324; Rosenfeld v. Standard Bottling & Extracts Co. 232 Mass. 239, 245; Conroy v. Toomay, 234 Mass. 384, 386; S. C. 255 Mass. 87, 90; Browne, St. Frauds (5th ed.) §§ 409a-428; Imperator Realty Co. Inc. v. Tull, 228 N. Y. 447, 454, 455. There is authority for saying that a written contract within the statute of frauds remains in full force, subject to the rule in Cummings v. Arnold just mentioned, notwith*39standing an attempted oral modification. Williams v. Moss’ Empires, Ltd. [1915] 3 K. B. 242. Williston, Contracts (Rev. Ed.) § 593. Am. Law Inst. Restatement: Contracts § 223 (2). But compare Morris v. Baron & Co. [1918] A. C. 1; British & Boningtons, Ltd. v. North Western Cachar Tea Co. Ltd. [1923] A. C. 48; Rose & Frank Co. v. J. R. Crompton & Brothers, Ltd. [1925] A. C. 445; Royal Exchange Assurance v. Hope, [1928] Ch. 179.
The contract in the present case was not within the statute of frauds. If partly in writing and partly oral it would have been perfectly valid. A peculiarity of the oral modification made on May 16, 1935, is that it consisted wholly of elimination of work required by the written contract. Apart from the extra work to be mentioned later, all the work that was done was included in the written contract. We think that labor and materials required for the doing of work specified in the written contract were “furnished by virtue of said contract” within G. L. (Ter. Ed.) c. 254, § 2, even though other parts of the work were eliminated by a completely valid oral modification of the written contract. It is unimportant that the plaintiffs erred in describing the modification as “written” in their statement of account under G. L. (Ter. Ed.) c. 254, § 8, and in their bill. There was no occasion for the plaintiffs to divide their claim into labor and materials.
As to certain parts of the work specified in the written contract, a different mode of performance was substituted, by oral agreement of the parties, for the mode of performance called for by the contract. The statement of account under G. L. (Ter. Ed.) c. 254, § 8, and the bill alleged performance of the written contract, except for the items eliminated by the oral modification of May 16, 1935. This was not improper. The case does not fall within decisions holding that recovery for substantial though inexact performance, even where exact performance is waived, cannot be had upon a declaration alleging full performance. Allen v. Burns, 201 Mass. 74. Putnam-Hooker Co. v. Hewins, 204 Mass. 426, 430. Hennessey v. Preston, 219 Mass. 61. Searls v. Loring, 275 Mass. 403, 406, 407. Zarthar v. *40Saliba, 282 Mass. 558, 561. Here there was a substituted performance agreed upon by the parties, not a mere waiver of nonperformance. What was done was the agreed equivalent of what was originally promised. Recovery for it may be had upon an allegation of performance. Whittier v. Dana, 10 Allen, 326. King v. Faist, 161 Mass. 449, 456, 457.
With small exceptions, the extras amounting to $1,119 “constituted new and additional or extra work beyond what was comprehended in the original [written] agreement.” The written agreement to pay for these extras, dated August 19, 1935, was never filed or recorded, and apparently was made after much of the extra work had been done. No lien exists for this extra work. But since it is not shown that the plaintiffs, in claiming a lien therefor, wilfully and knowingly claimed more than was due, the validity of the lien for work done by virtue of the written contract is not affected. G. L. (Ter. Ed.) c. 254, § 11.
There was due from the defendants to the plaintiffs $3,030 under the written contract as orally modified, and $1,119 for extra work, a total of $4,149. Payments were made to the -amount of $2,261.30, leaving a balance due the plaintiffs of $1,887.70. These payments were not appropriated by either party to specific items of the account, but were credited generally. Under these circumstances “the law makes such application as justice between the parties may require.” Cushman v. Snow, 186 Mass. 169, 173. Snell v. Rousseau, 257 Mass. 559. Justice has been said to require the application of a payment to an unsecured debt rather than to one secured. Parker v. Green, 8 Met. 137, 144. The rule that accepting a negotiable note for a secured debt does not pay the debt is an analogy in favor of this view. Freedman v. Peoples National Bank of Marlborough, 291 Mass. 168, 171. But later cases favor applying payments to the earlier items of the account, whether secured or unsecured. Crompton v. Pratt, 105 Mass. 255. Worthley v. Emerson, 116 Mass. 374. Snell v. Rousseau, 257 Mass. 559, 562. 97 Am. L. R. 356. In the present case *41the extra work was done "before September 12, 1935,” and it is inferable from the record that many items of extras were completed considerably before that date. As to the original written contract, the finding is that "the work was completed on or before September 12, 1935.” We think that there was no error in applying the payments to the extras as the earlier items of the account, and in establishing a lien for the entire unpaid balance of $1,887.70, with interest from the date of filing of the bill.
Decree affirmed with costs.