
11 Cal.2d 122 (1938)
CORA LORD COPP, Appellant,
v.
VELLZORA MILLEN et al., Defendants; WINFIELD RUSSELL, Respondent.
L. A. No. 15392. 
Supreme Court of California. In Bank.  
April 4, 1938.
 Andrew J. Copp, Jr., for Appellant. *124
 Walker R. Flint for Respondent.
 SHENK, J.
 This appeal presents a question of priority as between a mortgage, which had been released of record and renewed, and a contract of sale executed by the owner to a third person between the date of the execution of the original mortgage and the date of the release and renewal thereof.
 On July 15, 1923, Vellzora Millen executed and delivered to Andrew J. Copp, Jr., a mortgage for $1250, due in three years, on a parcel of land in the city of Los Angeles. At the same time she also executed a deed of trust to Copp on the same property to secure payment of $885.55. The aggregate of those sums represented the balance due from Vellzora Millen to Copp on the original purchase price of $2,500. Both instruments were duly recorded. Subsequently and on November 1, 1923, Vellzora Millen entered into a contract of purchase and sale of said property with Winfield Russell for the sum of $3,500. No mention was made in the contract of sale of the mortgage and trust deed, and Russell had no actual knowledge of their existence. He went into possession and made monthly payments of principal and interest on the purchase price. The contract was not recorded.
 The mortgage and trust deed were assigned by Copp to his wife, Cora Lord Copp, the plaintiff herein. Vellzora Millen defaulted in the payments under the mortgage and trust deed, and on September 10, 1929, when the statute of limitations was about to bar an action in foreclosure, she executed and delivered to Cora Lord Copp a new note and mortgage for $1458.48, which represented the balance due under the original mortgage and trust deed. At the same time the original mortgage and trust deed were satisfied and discharged of record. The new mortgage was duly recorded.
 At the time of the discharge on the record of the original mortgage and trust deed, Russell had paid $2,917.27 to Vellzora Millen on the principal amount called for under his contract of purchase, plus interest thereon, and subsequently he paid the balance due thereon.
 On May 25, 1934, Cora Lord Copp brought an action to foreclose the mortgage dated September 10, 1929, naming as defendants Vellzora Millen and Winfield Russell. Vellzora Millen defaulted. Russell answered alleging ownership and possession of the property under the contract of sale and the *125 plaintiff's actual knowledge thereof. He also filed a cross- complaint wherein he sought to quiet his title to the property. The plaintiff filed an answer to the cross-complaint wherein she set up the mortgage and trust deed of July 15, 1923, and denied knowledge of the existence of the contract. She also alleged that the mortgage of September 10, 1929, was a renewal of the mortgage and trust deed of 1923; that such renewal was intended by the parties as a continuance of the obligation; that the satisfaction of record was solely for the purpose of extending the maturity of the principal obligation and continuing the lien upon the real property as security therefor; that the recital on the record of the release and discharge of the mortgage and trust deed was made by mistake of the parties, but that in truth the debt had not been paid and that the release was given merely for the purpose of affording the mortgagor Vellzora Millen more time within which to pay the debt secured by the mortgage and trust deed by permitting her to make a renewal thereof; that the only agreement between the parties in fact was not one of release but was to the effect that the renewal was given and accepted for the purpose of extending the time of payment of the balance due on the original debt. On those allegations the plaintiff sought judgment of foreclosure as prayed in her complaint.
 The trial court found that on September 10, 1929, the plaintiff had actual notice and knowledge of the unrecorded contract of sale. On the basis of such knowledge, and its findings of the facts hereinabove noted, the court rendered judgment in the sum of $1439.95 for the plaintiff and against the defendant Vellzora Millen, but denied the plaintiff any right of foreclosure. It decreed the right of the defendant Russell to the ownership and possession of the property. The plaintiff appealed. She charges error in the conclusion of the court that she is not entitled to foreclosure, and in its rulings excluding certain proffered evidence. She invokes the application of the equitable principles stated in Parker v. Tout, 207 Cal. 590 [279 P. 431], White v. Stevenson, 144 Cal. 104 [77 P. 828], Van Sandt v. Alvis, 109 Cal. 165 [41 P. 1014, 50 Am.St.Rep. 25], Shaffer v. McCloskey, 101 Cal. 576 [36 P. 196], and Tolman v. Smith, 85 Cal. 280 [24 P. 743]. *126
 [1] The evidence, including that offered and rejected by the court, is that the parties did not intend the mortgage of September 10, 1929, as payment of the debt, but intended merely to extend the time for payment by executing a renewal mortgage for the balance due, and that the entry on the record of satisfaction and release of the original security was by mistake of the parties thereto. It also appears therefrom that the entry of the release was due to the mistake of the parties acting under the belief that such renewal mortgage would be a first lien on the property, and that this belief was induced by the report of the title company that no intervening liens appeared of record. Where such facts are present and the equities justify it, the courts have decreed a revival of the old mortgage as a continuing lien. The equitable principle has been variously stated, according to the circumstances of each case: "But as to the debts secured by the original mortgage ..., we regard the cancellation of the old mortgage and the substitution of the new as contemporaneous acts. It was not creating a new encumbrance, but simply changing the form of the old. A court of equity, looking to the substance of such a transaction, would not permit a release, intended to be effectual only by force of and for the purpose of giving effect to the last mortgage, to be set up, even if the last mortgage was inoperative." (Van Sandt v. Alvis, supra, p. 169, quoting from Swift v. Kraemer, 13 Cal. 530 [73 Am. Dec. 603].) Applying that principle it was held that the trial court was justified in concluding that the first mortgage, having been satisfied only for the purpose of giving effect to the second one, would in equity be deemed to be and remain in force until the demand secured thereby was barred, and that a foreclosure could be decreed as to the note which was not barred.
 In Tolman v. Smith, supra, it was said (p. 287) that the substitution of a new mortgage did not operate to discharge the old ones, but merely suspended the remedy upon them. "It is well settled that, in the absence of an agreement to that effect, the payment of one note by another is only conditional and not absolute payment. It extends the time for payment until the maturity of the new note, or, as it is said, 'suspends' the remedy upon the old note, but does not extinguish it." And at page 289: "And so where, as in the case before us, one mortgage is substituted for another, equity *127 will keep the first alive when the interests of justice require it."
 "By a doctrine closely akin to that of equitable subrogation, and it seems to us one founded in equal equity and reason, the old mortgage, though released, must be substituted for the new and treated as a continuing lien securing the continuing debt." (American Sav. Bank & Trust Co. v. Helgesen, 67 Wash. 572 [122 P. 26, Ann. Cas. 1913A, 390].)
 [2] The defendant Russell contends that the action by the plaintiff must have been one brought to revive and continue the old mortgage in existence, and that the plaintiff is not entitled to the relief sought under the allegations of her complaint. However, the material allegations in that respect appear by the cross-complaint and the answer thereto, which may be deemed appropriately to have raised those issues in connection with the action of foreclosure (White v. Stevenson, supra, p. 112), and for that reason the trial court erred in dismissing the cross- complaint.
 [3] Assuming that otherwise the equities are in favor of reviving and continuing the old mortgage and trust deed, it becomes apparent that the same can be revived and continued as against the defendant Russell unless the bar of the statute of limitations intervenes to prevent it. (Sec. 337, Code Civ. Proc.; Barber v. Babel, 36 Cal. 11, 23.) The defendant Millen could not, by renewal, extension, default or otherwise, waive the bar of the statute so as to preclude its invocation by the defendant Russell. (Flack v. Boland, ante, p. 123 [77 P. 1090]; Ekmann v. Plumas County Bank, 215 Cal. 671, 673 [12 PaCal.2d 433]; 18 Cal.Jur., p. 416 et seq., and cases cited.) Inasmuch as the defendant Russell did not urge the bar of that statute, we deem it expedient to examine into the considerations controlling the equities between the parties aside from any question of the statute of limitations.
 In White v. Stevenson, supra, it was said: "Mistake is the foundation of one of the chief branches of equity jurisprudence, and the exercise of equity jurisdiction is frequently had where a contract as written does not express the terms of the actual agreement between the parties. This jurisdiction is often invoked to set aside or cancel the release of a mortgage that has been given under a mistake of fact, or contrary to the evident intention of the parties; notably when, *128 upon the execution of a new mortgage, in renewal or as a substitute for a prior one, the former mortgage is released in ignorance of the existence of an intervening lien. Equity looks at the intention of the parties, and will control the effect of a release executed under a mistake of fact, or cause it to be cancelled, when no intervening rights have accrued by reason of the mistake." And, quoting from Barnes v. Camack, 1 Barb. (N.Y.) 392: "The principle which runs through all cases of this description is that when the legal rights of the parties have been changed by mistake, equity restores them to their former condition, when it can be done without interfering with any new rights acquired on the faith and strength of the altered condition of the legal rights, and without doing injustice to other persons." The granting of equitable relief is, however, not limited to those cases wherein the mortgagee had no notice of the lien of the intervening encumbrancer. In Iowa County Bank v. Pittz, 192 Wis. 83 [211 N.W. 134], the mortgagee had both constructive and actual knowledge of intervening liens. It was held that the equities of the case required that the original mortgage be maintained as a continued and paramount lien.
 In a case in which the intervening lienor held a mortgage which was a matter of record, it was held nevertheless that the equities required the continuance of the old lien as against the intervening lienor. The court said: "The effect of the transaction was merely to continue plaintiff's original mortgage ... If it had by mistake released its mortgage without intending to do so, as, for instance, by executing a release supposing that it had a paper of a different character, or that the release executed was that of a mortgage upon a different piece of property, there can be no doubt that equity, upon the satisfactory proof that it requires in such case, would relieve the plaintiff from the result of such action, and reinstate the mortgage which had been discharged by mistake. Equity always looks to the substance, and not to the form, of the transaction. There being no intention to release the lien of the first mortgage, its actual release for a momentary period should not, in equity, permit a subsequent lienor to intervene and acquire priority." It was concluded that the relief could be granted although the mistake was not unmixed with negligence. "Unless the mistake is rectified, Isacs [the subsequent lienor] will obtain an unconscionable *129 advantage. The correction of the mistake will leave him in his original position and deprive him of no right to which he is justly entitled." (Lomas & Nettleton Co. v. Isacs, 101 Conn. 614 [127 Atl. 6].)
 In Capital Lumbering Co. v. Ryan, 34 Or. 73 [54 P. 1093], the subsequent encumbrance was a mechanic's lien. The mortgagee was relieved from the mistake in releasing the original mortgage and taking a renewal thereof where at the time the mortgagee knew that a building was in course of construction and uncompleted. In Bormann v. Hatfield, 96 Wash. 27 [164 P. 921, L.R.A. 1917E, 1052], the intervening lien was a matter of public record at the time the release and renewal were executed. The representation of the mortgagor that no intervening liens existed was held to excuse the omission to examine the records before executing the renewal mortgage. The court concluded: "Therefore a subsequent mortgagee who becomes such anterior to the discharge of a prior mortgage cannot, with any show of reason or justice, claim to be injured by the setting aside of the subsequent release and restoring the lien of the prior mortgage. He is in no way prejudiced, but is left to enjoy exactly what he expected to get when he accepted the second mortgage. (Citing cases.)" It was pointed out in Holt v. Mitchell, 96 Colo. 412 [43 PaCal.2d 388, 98 A.L.R. 838], referring to McKenzie v. McKenzie, 52 Vt. 271, that they who are not injured should not be permitted to "speculate in another's blunders". (See, also, Pacific National Agricultural Credit Corp. v. Wilbur, 2 Cal.2d 576 [42 PaCal.2d 314]; and notes, 33 A.L.R., p. 149 et seq.; 98 A.L.R., p. 848 et seq.)
 [4] As shown by the decisions herein cited, the courts in this state have applied the principle that wherever it is shown that the discharge or release was intended, not as payment, but as an extension or renewal of or substitution for the original debt and security, relief will be granted in accordance with the equities in each individual case. Thus in Shaffer v. McCloskey, supra, the intervening lien was on record at the time the supposed satisfaction was given. The contention was that the plaintiff was bound by the constructive notice. The court affirmed a judgment granting the equitable relief saying: "In our opinion the judgment should be affirmed. It will be noticed that the judgment in this *130 case does not weaken any position which appellants were induced to take by any conduct of the respondent. It does not take away from them any money which they were induced to invest by any act or laches of respondent; nor does it lessen the value of any security which he in any way induced them to take. They did not acquire any lien after the mortgage had been marked satisfied, and were not led by a clear record to invest money in the land. They took the deed of trust while the mortgage was in full legal existence, recorded and unsatisfied, and with perfect understanding that it was a valid prior lien, and they are merely seeking to take an advantage offered by an inadvertence or mistake of respondent. This is what equity will not allow."
 [5] It follows from the foregoing that some knowledge or means of knowledge of the existence of other person's rights in the property does not in every case preclude the court from granting the relief sought. So that if, notwithstanding the mortgagee had some knowledge or notice, the intervening lienholder is not prejudiced by the continuance of the priority of the original mortgage and is in no different position than he would have been had the release not been recorded, equity will place the parties in their original position.
 There is evidence in the record to sustain the trial court's finding that the plaintiff had actual knowledge that the property had been sold by Vellzora Millen to Russell and that the latter was in possession. But it does not appear that the plaintiff knew or should have known that Russell's unrecorded contract to purchase was not subject to the plaintiff's mortgage.
 [6] The position of Russell has not been materially changed by the release on the record, with the possible exception relating to the amounts thereafter paid by him under his contract. Therefore under the applicable authorities the plaintiff is entitled to relief at least to the extent that Russell suffered no prejudice by said release. The trial court apparently concluded that the plaintiff's knowledge of the existence of Russell's contract was alone sufficient to exclude the plaintiff from any relief by way of foreclosure. The court refused to admit evidence offered by the plaintiff to show the circumstances under which the release and renewal of the mortgage and trust deed were made. In this the court was in error substantially affecting the rights of the plaintiff. *131 Such evidence was admissible, as well as evidence on the question of whether Russell suffered any prejudice for which the plaintiff was responsible.
 [7] When a defendant fails to avail himself of the defense of the statute of limitations, it is discretionary with the trial court whether after a reversal on appeal he should be allowed to urge the defense on a second trial. This right was allowed in Trower v. San Francisco, 157 Cal. 762, 769 [109 P. 617]. On the other hand action of the trial court in refusing to permit the defendant to make a tardy plea of the statute during a first trial has been sustained. (San Joaquin Valley Bank v. Dodge, 125 Cal. 77, 83 [57 P. 687]; Cooke v. Spears, 2 Cal. 409 [56 Am. Dec. 348]; Rossi v. Jedlick, 115 Cal.App. 230, 236 [1 PaCal.2d 1065]; Richards v. Silveria, 97 Cal.App. 166 [275 P. 478]; Hewel v. Hogin, 3 Cal.App. 248 [84 P. 1002].)
 The judgment is reversed.
 Waste, C.J., Seawell, J., Curtis, J., and Langdon, J., concurred.
