Crookall v. Davis, Punelli, Keathley & Willard

*1052Opinion

EPSTEIN, J.

Charles E. Crookall appeals from summary judgment entered in favor of his former attorneys in his action for legal malpractice. The issue on appeal is whether there is a triable issue of material fact as to negligence by respondent attorneys in failing to raise the defense of the antideficiency judgment statute, Code of Civil Procedure section 580b, in the underlying action. The seller of the subject property sold the property, taking back a note secured by a first trust deed. The seller agreed to subordinate its security to a construction loan the buyer anticipated it would obtain. But a construction loan was not obtained, and the seller was never called upon to subordinate.

We conclude that the underlying transaction came within section 580b, and therefore the trial court erred in granting summary judgment to both groups of respondents.

Factual and Procedural Summary

Pacific Scientific Company (PSC or seller) owned 9.18 acres in Anaheim which had been improved with a 74,000-square-foot manufacturing facility and a 17,000-square-foot 2-story office building. In 1989, PSC put the property up for sale. Donald W. Shaw and appellant Charles E. Crookall, acting through their partnership, Shaw/Crookall, entered into a transaction to purchase the property.1 Their plan was to develop a commercial business park and to sell the units.

As originally structured, the purchase price was to be $7,375,000, payable as follows:

1. $1,475,000 cash through escrow.
2. A $5.9 million promissory note secured by a first trust deed.

In August 1989, the parties amended the escrow instructions, reflecting a renegotiation of the payment terms. The sale price was reduced by $1 million to $6,375,000. It was to be paid by $5,375,000 in cash at close of escrow, and a promissory note secured by a deed of trust for the remaining $1 million. This note was to be paid at the earlier of the sale of the first unit in the contemplated planned unit development (PUD) to be built on the property by buyers, or December 28, 1990. The seller agreed to subordinate the deed of trust to a construction loan to be obtained by buyers. In addition, *1053buyers agreed to pay seller an additional $1 million plus interest from the proceeds of sales of units in the PUD.

In December 1989, the parties again renegotiated the terms of their agreement. The purchase price remained at $6,375,000 to be paid:

1. At the close of escrow, $2 million in cash.
2. A promissory note for $4,375,000, secured by a first trust deed on the property.
a. $3,375,000 of the note was to be paid upon the earlier of funding of the construction loan to be obtained by buyers or March 31, 1990.
b. The remaining $1 million plus interest to be paid upon the earlier of 19 months following recordation of the construction loan, or November 30, 1991. All other terms of the note remained the same.
3. An additional $1 million to be paid after completion of development of the business park, upon sale of the property (Contingent Payment Agreement, recorded as a lien on the property).

The deed of trust executed in December 1989 provided for subordination to the anticipated construction loan: “[PSC] agrees to subordinate the lien of this Deed of Trust with Assignment of Rents (‘Deed of Trust’) to the lien of a first deed of trust (‘First Deed of Trust’) to secure a construction loan (‘Construction Loan’) to be obtained by [buyers] for the purpose of constructing improvements on the Property . . . .”

The Contingent Payment Agreement also contained a subordination clause, by which seller agreed it would “at all times remain subject, subordinate and inferior to the Construction Deed of Trust. In the event of foreclosure of the Construction Deed of Trust or upon a sale of the Property pursuant to the trustee’s power of sale contained therein, or upon a transfer of the Property by conveyance in lieu of foreclosure, then this Agreement shall continue in full force and effect as a direct agreement between the succeeding owner of the Property and Seller.”

The parties also entered into an “Environmental Cleanup Agreement.” That contract obligated the seller to perform specified environmental testing and cleanup work on the property, to be completed by March 31, 1990. The completion date later was extended to August 31, 1990.

Escrow closed in December 1989. Some five months later, on May 30, 1990, the parties changed the terms of the transaction for the final time. The promissory note was amended to provide:

*10541. Payment of $2,789,857 principal, due on the earlier of the recordation of the construction loan to be obtained by buyers, or 30 days after the delivery of certification that the environmental cleanup agreement had been fulfilled.
2. A second principal payment of $700,000, plus all accrued interest, on the earlier of the closing of the sale of the real property, or nine months from the recordation of the construction loan, but not later than June 30, 1991.
3. The remaining principal of $885,143 plus interest was due on the earlier of the closing of the sale of the real property or November 30, 1991.

Upon taking possession of the property, the buyers demolished the existing manufacturing facility, graded the property, and had pads laid for the 10 industrial buildings , to be built. They certified the site as ready for construction. By fall 1991, the environmental cleanup had not been completed and no construction loan had been obtained.2 The buyers made no payments on the $4,375,000 promissory note. The buyers sued the seller, seeking damages or rescission. (Shaw v. Pacific Scientific Co. (Super. Ct. Orange County, 1991, No. 667105).)

The seller cross-complained, seeking foreclosure and damages for waste.3 In December 1991, seller foreclosed. The buyers retained Davis, Punelli, Keathley & Willard (the Davis firm) to represent them.4 Five months before trial, buyers substituted the Law Offices of David M. Harney (the Harney firm) as counsel of record.

In a jury trial, special verdicts were returned against the buyers on their complaint, on the basis that there was no ground for rescission and that PSC was not negligent. The jury found that the buyers recklessly or intentionally caused waste on the property and that the seller was entitled to recover on that cause of action.

The trial court entered judgment on the underlying complaint as follows:

1. Shaw/Crookall was to recover nothing on its complaint against PSC.
*10552. PSC was to have judgment against Shaw/Crookall on its cross-complaint for foreclosure based on default of the promissory note.
3. PSC was to recover $6,392,177 plus interest, trustee’s fees and expenses, and the actual costs of foreclosure and sale from Shaw/Crookall.

The trial court ordered the property to be sold, with the proceeds, less costs and expenses, to be paid to PSC. Any surplus was to go to Shaw/ Crookall. Shaw/Crookall was found liable for any deficiency that might result after the sale proceeds were applied to the secured debt. The trial court retained jurisdiction to determine the amount of deficiency, if any.

PSC was awarded damages for waste in the amount of $300,000 for diminution in market value, and $303,343 for unpaid real property taxes, which increased $3,315 on the first day of each month. Shaw/Crookall was held liable for these amounts “to the extent that the amount Shaw/Crookall is indebted to Pacific Scientific on the Note, ... is not satisfied by application of the proceeds from the foreclosure sale ordered by the Court.”

The foreclosure sale was held in August 1994 and the property was sold to PSC for $2.8 million. PSC then moved for a deficiency judgment for the difference between the foreclosure sale price and the judgment. It sought to hold Shaw and Crookall personally liable for this amount. Shaw opposed the motion, and Crookall joined in his opposition. They asserted that Code of Civil Procedure section section 580b (section 580b) precluded a deficiency judgment. They argued that no evidence had been presented at trial on the applicability of section 580b, and that PSC had failed to pursue its claim for deficiency before the court at trial.

The trial court concluded that the antideficiency provisions of section 580b did not apply. The court found: “The court lacks jurisdiction to now determine whether or to what extent said issue was litigated or whether it was properly determined. Therefore, Shaw/Crookall’s attempt to seek the shelter of the anti-deficiency statute, being first raised at this time, comes too late to permit the court to consider whether or not CCP section 580b should, in fact, be applied herein. The jurisdiction, which the court retained to determine the amount of the deficiency, if any, does not extend jurisdiction to the court to now determine that CCP 580b precludes the entry of a deficiency judgment. If the determination contained in the decree of foreclosure is in error, Shaw/Crookall’s only available remedy lies in the Court of Appeal.”

The trial court also held that Mr. Shaw and Mr. Crookall were personally liable on the judgment under the principles of partnership law. It found: *1056“The court rejects the argument that, since the partners were not subject to the decree of foreclosure, previously entered herein, they may separately now litigate the applicability of CCP 580 (b). Such an argument might have merit had they not been parties in their individual capacity throughout these proceedings. However, since they were such parties and fully participated in all of the proceedings in their individual as well as their partnership capacities, they are fully bound by the provisions of the previously entered decree of foreclosure, including the provision discussed above, relating to the applicability of the anti-deficiency statute.” The trial court held each partner individually liable for the deficiency judgment.5

Appellant, Charles Crookall, sued the Davis firm, Frank Punelli, Eric Davis, Jim Keathley, Kathy O’Brien, Eric Anderson, as well as the Harney firm, Thomas Kallay, and David M. Harney for legal malpractice. The charging pleading is the first amended complaint. Appellant alleges that respondents were professionally negligent for failing to raise the defense of section 580b, the antideficiency statute.

The Davis firm moved for summary judgment on the ground that the antideficiency protection of section 580b did not apply to the underlying transaction, and therefore, it was not malpractice to fail to raise this defense. The Harney firm, Mr. Harney, and Mr. Kallay joined in the motion.

Appellant opposed the motion, arguing that the underlying financing agreement was a standard purchase money transaction to which section 580b applied. Alternatively, he argued that even if it were not, it was within the purposes of section 580b, and therefore respondents were negligent in failing to raise the defense. We shall review the parties’ respective positions on this issue in our discussion of the applicability of section 580b.

The trial court granted summary judgment to defendants, with extensive findings. Appellant’s motion for new trial was apparently denied. Judgment for respondents was entered and appellant filed a timely notice of appeal.

Discussion

I

The primary issue in this appeal is whether the antideficiency statute, section 580b applies to the lending agreement in this case. If it does not, respondent attorneys cannot be liable for having failed to raise it, since *1057failure to raise a nonapplicable argument cannot result in legal damages. If the statute does bar a deficiency, the trial court erred in granting summary judgment to respondents.

We apply the standard rules in reviewing a summary judgment. “ ‘The motion for summary judgment shall be granted if all the papers submitted show that there is no triable issue as to any material fact and that the moving party is entitled to a judgment as a matter of law. . . .’ [f A defendant meets his or her burden on a motion for summary judgment if that party has proved there is a complete defense to the cause of action. (§ 437c, subd. (o)(2).) Once the defendant has met that burden, the burden shifts to the plaintiff to show that a triable issue of one or more material facts exists. [Citations.] [1]] On appeal, we independently assess the correctness of the trial court’s ruling, applying the same legal standard as the trial court. [Citations.] ‘ “[W]e construe the moving party’s affidavits strictly, construe the opponent’s affidavits liberally, and resolve doubts about the propriety of granting the motion in favor of the party opposing it.” . . .’” (Van Dyke v. Dunker & Aced (1996) 46 Cal.App.4th 446, 450-451 [53 Cal.Rptr.2d 862].)

We begin with a brief review of the governing statute and principal decisions that bear on purchase money transactions and deficiency judgments. “In the absence of a statute to the contrary, a creditor secured by a trust deed or mortgage on real property may recover the full amount of the debt upon default.” (Roseleaf Corp. v. Chierighino (1963) 59 Cal.2d 35, 38 [27 Cal.Rptr. 873, 378 P.2d 97] (hereafter Roseleaf).) In California, the creditor must rely upon his security before enforcing the debt. (Ibid.) But if the security is insufficient, the creditor’s right to a deficiency judgment is limited by section 580b, which provides in pertinent part: “No deficiency judgment shall lie in any event after a sale of real property ... for failure of the purchaser to complete his or her contract of sale, or under a deed of trust or mortgage given to the vendor to secure payment of the balance of the purchase price of that real property . . . .” Thus, under section 580b, where a seller finances a sale of real property through a purchase money obligation, a deficiency judgment is prohibited. (Ghirardo v. Antonioli (1996) 14 Cal.4th 39, 49 [57 Cal.Rptr.2d 687, 924 P.2d 996].)

“Section 580b places the risk of inadequate security on the purchase money mortgagee. A vendor is thus discouraged from overvaluing the security. Precarious land promotion schemes are discouraged, for the security value of the land gives purchasers a clue as to its true market value. [Citation.] If inadequacy of security results, not from overvaluing, but from a decline in property values during a general or local depression, section 580b prevents the aggravation of the downturn that would result if defaulting *1058purchasers were burdened with large personal liability. Section 580b thus serves as a stabilizing factor in land sales.” (Roseleaf, supra, 59 Cal.2d at p. 42.)

In 1953, the California Supreme Court held that section 580b applies to a junior lienor whose security has been rendered valueless by foreclosure of a senior encumbrance. (Brown v. Jensen (1953) 41 Cal.2d 193, 198 [259 P.2d 425].) The Brown decision was followed several years later by Rose-leaf. In that case, Roseleaf Corporation sold its hotel to the Chierighino family. The consideration included a note secured by a first trust deed, chattel mortgages, and three notes each secured by a second trust deed on three other parcels owned by one of the Chierighinos. The case concerned Roseleaf’s rights as junior lienor on the three other parcels after the holders of the senior notes sold those parcels under powers of sale contained in the first trust deeds.

The Roseleaf court distinguished between senior and junior lienors: “The position of a junior lienor whose security is lost through a senior sale is different from that of a selling senior lienor. A selling senior can make certain that the security brings an amount equal to his claim against the debtor or the fair market value, whichever is less, simply by bidding in for that amount. He need not invest any additional funds. The junior lienor, however, is in no better position to protect himself than is the debtor. Either would have to invest additional funds to redeem or buy in at the sale. Equitable considerations favor placing this burden on the debtor, not only because it is his default that provokes the senior sale, but also because he has the benefit of his bargain with the junior lienor who, unlike the selling senior, might otherwise end up with nothing.” (59 Cal.2d at p. 41.) The court observed: “Roseleaf would clearly be barred by section 580b from suing on the note secured by the first trust deed and chattel mortgage on the hotel and its furnishings.” (Ibid, at p. 41.)

The Roseleaf court considered whether section 580b applied. First, it described the standard purchase money transaction as one in which the vendor of real property retains an interest in the land sold to secure payment of part of the purchase price. (59 Cal.2d at p. 41.) “Variations on the standard are subject to section 580b only if they come within the purpose of that section.” (Ibid.)

The court concluded that the transaction at issue did not fall within the purpose of section 580b. Based on the absence of evidence that the hotel was overvalued, the Roseleaf court concluded that section 580b did not apply. To hold otherwise, it reasoned, would allow the Chierighinos to acquire the *1059hotel at less than the agreed price. The court also noted that there was no reason to find that Roseleaf knew the value of this security, in that there was no reason to assume Roseleaf knew any more about the value of the additional three parcels secured by the second trust deeds than did the Chierighinos. (59 Cal.2d at pp. 42-43.)

Appellant argues that contrary to the trial court’s ruling, the transaction between PSC and Shaw/Crookall was a standard purchase money transaction. He bases this argument on the fact that PSC, as seller, retained an interest in the property to secure part of the purchase price; the subordination clause was never executed because no construction financing was obtained; the anticipated change in use was irrelevant because PSC relied only on the land as security; and because PSC was separately compensated for the demolished structures by the award of damages for waste. Alternatively, appellant argues that the trial court erred in failing to perform a factual analysis to determine whether the transaction comes within the purposes of section 580b.

Both the Davis firm and the Harney firm argue that the transaction does not come within section 580b because it was not a standard purchase money mortgage. Based on this reasoning, they conclude that the trial court correctly ruled that they had no duty to plead section 580b as an affirmative defense, and were properly granted summary judgment. They invoke a judicially created exception to section 580b, explained in Spangler v. Memel (1972) 7 Cal.3d 603 [102 Cal.Rptr. 807, 498 P.2d 1055] (Spangler). Based on Spangler, respondents urge the proposed change in use of the property is sufficient in itself to make the transaction a nonstandard purchase money agreement. They argue that the structuring of the transaction to include both a subordination clause and a contingent payment to PSC from the proceeds of the planned unit development, demonstrates that both PSC and Shaw/ Crookall recognized that a change in use was planned. In addition, as soon as Shaw/Crookall took possession, it demolished the existing structures, impacting the security value of the property. In light of these factors, they contend the security value of the property at time of sale was not a reliable indicator of its future worth.

Appellant responds that where there has been no actual subordination of the seller’s security interest, a contemplated change in use is irrelevant to application of section 580b.

The parties do not cite, and we have not found, any California case saying that the buyer’s contemplated change in use of the property is in itself sufficient to negate the effect of section 580b where the seller is the senior *1060lienholder in a purchase money transaction. All of the reported cases allowing a deficiency judgment to the seller involve a situation where the seller has become a sold-out junior lienholder subordinated to a construction loan. If PSC’s first trust deed actually had been subordinated to a construction loan, we would conclude that section 580b did not apply. But, as we explain, that is not our case. This is a standard purchase money mortgage to which section 580b applies.

Crookall relies on Budget Realty, Inc. v. Hunter (1984) 157 Cal.App.3d 511 [204 Cal.Rptr. 48]. Because that case distinguishes the landmark Supreme Court decision in Spangler, we review the Spangler opinion before turning to Budget.

In Spangler, Ralf and May Spangler owned a single-family, two-story residence on Sunset Boulevard in Los Angeles. The property, which was zoned for commercial use, was used by Ralf as an office. When the property appreciated in value because of the possibility a commercial office building might be built on the site, the Spanglers listed it for sale. The Memel-Kossoff partnership agreed to buy the property. The sale price was $90,000 on the following terms: $26,100 in cash, and a promissory note for $63,900 secured by a purchase money deed of trust, which was to be subordinated to construction loans up to the amount of $2 million. The four individual general partners of Memel-Kossoff gave personal guarantees of joint and several liability on the note and waived their protection from deficiency judgments in return for the subordination agreement.

Memel-Kossoff transferred the property to another partnership, MKS Investment Co., which obtained a construction loan secured by a first deed of trust. Union Bank, which issued the loan, required May Spangler to execute a specific subordination agreement recognizing that the bank’s lien had priority. MKS constructed an office building on the property, but it was unsuccessful. As a result, MKS did not make payments upon the construction loan, and Union Bank foreclosed. The sale price was less than the amount of the indebtedness, so Union Bank recovered a deficiency judgment from the individual partners. (Spangler, supra, 7 Cal.3d at pp. 606-607.)

May Spangler sued to enforce the guarantees signed by the individual partners. The trial court entered judgment in her favor, holding that the partners could not invoke the defense of section 580b. On appeal, the partners argued the judgment was barred by section 580b. Following a review of its earlier decisions in Brown v. Jensen, supra, 41 Cal.2d 193 and Roseleaf, supra, 59 Cal.2d 35, the court affirmed its ruling in Brown v. Jensen that section 580b by its language applies to sold-out junior lienors *1061holding a purchase money mortgage or deed of trust. “We point out, however, that as we said in Roseleaf, such ruling applies automatically only to the standard purchase money situation. We are of the view that if the transaction in question is a variation on the standard purchase money mortgage or deed of trust transaction, it should be examined so as to determine whether it subserves the purposes of section 580b as explicated by us in Roseleaf and Bargioni [v. Hill (1963) 59 Cal.2d 121 [28 Cal.Rptr. 321, 378 P.2d 593]].” (Spangler, supra, 7 Cal.3d at p. 611.)

The Spangler court announced a two-part test to determine whether section 580b applies. First, the court must decide whether the secured loan is a standard purchase money transaction to which section 580b automatically applies. (7 Cal.3d at p. 611.) If it is not, then the court must analyze the factual setting of the transaction to determine whether the transaction comes within the purposes of section 580b. (7 Cal.3d at pp. 611-612.) The Supreme Court identified two factors important to whether a transaction is a variation or standard: the subordination of the senior lien to a construction loan and a plan to put the property to a different, improved use.

In developing the two-part test, the Supreme Court considered the significance of the present security value of the property. “In the standard transaction the vendor usually sells the property to a purchaser who is going to continue the same or similar use of the property. The present security value of the property, therefore, is a reliable indicator of its actual fair market value. However, in the situation where the vendor agrees to subordinate his lien to the purchaser’s construction loan, the purchaser does not intend to continue with the same use of the property but actually intends a different use which contemplates considerable improvement of it. In this latter situation, the present security value of the property, therefore, is not a reliable indicator of the ultimate value of the property; that value will be determined by the success of the venture which contemplates a change in the use of the property.” (Spangler, supra, 7 Cal.3d at p. 611, original italics.)

Based on this rationale, the Spangler court held: “[T]he subordination clause situation is sufficiently different from the standard purchase money mortgage situation to remove it from the automatic application of section 580b and to require an analysis of this factual setting in light of the purposes of section 580b in order to determine the applicability of the section.” (7 Cal.3d at pp. 611-612.)

In conducting this factual analysis, “the first clear purpose of [section 580b] is to prevent overvaluation in those situations where ‘the security value of the land gives purchasers a clue as to its true market value,’ by *1062placing the risk of inadequate security on the purchase money mortgagee. In the standard purchase money mortgage transaction involving a junior lienor, the purchaser generally speaking has not been able to meet the value placed on the land by the vendor by giving the latter a normal cash down payment and obtaining from a third party lender a loan for the balance of the purchase price using the property as security. Obviously such a loan could not be obtained since the amount of the loan would exceed the security value. Instead, it usually happens that the purchaser will finance the balance of the purchase price by obtaining a third party loan equal to the security value, secured by a first deed of trust on the property, and by also giving the vendor a promissory note for the difference between the purchase price (less any down payment) and the security value, said note being secured by a second deed of trust on the property. We reasoned in Roseleaf that in such situation, the inability of the purchaser to obtain the purchase price from a lender using the land as security, should warn the vendor that he is perhaps overvaluing the land, and that he insists, at his peril, upon his premium price secured by a second trust deed.” (Spangler, supra, 7 Cal.3d at p. 612.)

But the analysis is different when the sale agreement contains a subordination clause. “Because of the unique character and effect of that clause, the security value of the land at the time of the agreement gives neither vendor nor purchaser any clue as to its true market value. In the typical subordination clause situation, the vendor is selling the property for commercial development; for example, in the instant case, defendants purchased the land for the purpose of constructing and operating a commercial office building. The market value of the land depends upon the likelihood of the success of the commercial development; the success of the commercial development depends upon the obtaining of loans to construct it; the securing of these loans depends upon the ability of the purchaser to give the lender a senior security interest. Consequently a vendor, who wishes to receive a purchase price reflecting the commercial potential of the project must be willing to subordinate his security interest to that of the construction lender. [^] If in such situation section 580b is applied to prevent the vendor from suing on his promissory note, after the development has failed and the senior lienor has caused the property to be sold, the risk of the failure of the commercial development is thrust upon the vendor. In fact, however, the success of the commercial development depends upon the competence, diligence and good faith of the developing purchaser. It would seem proper, therefore, that the purchaser not the vendor bear the risk of failure, particularly since in the event of default, the junior lienor vendor will lose both the land and the purchase price.” (Spangler, supra, 7 Cal.3d at p. 613.)

Thus, section 580b does not apply because the risk of failure of the proposed development should be placed on the purchaser-developer: “In this *1063factual context, the security value of the property at the time of the sale, which in Roseleaf we found to be at once an indicator of market value and a significant factor in deterring overvaluation by the vendor, gives no clue to market value, since the sale contemplates radical improved and changed use of the property. Effective prevention of overvaluation in a sale of property for commercial development utilizing a subordination clause lies in forcing the purchaser-developer to make realistic assessments of the likelihood of the project’s success and in inducing him to exert his highest efforts in carrying it out. We think this can be accomplished by placing the risk of failure upon the purchaser-developer where it in reality belongs, by permitting the sold-out junior lienor vendor to recover a deficiency judgment in an action on his promissory note. We are of the opinion that the purpose of preventing overvaluation in this context is best subserved by not applying section 580b.” (Spangler, supra, 7 Cal.3d at p. 613.)

The Spangler court identified another factor present in the subordination clause context, which distinguishes it from the standard purchase money transaction. The amount of a construction loan is usually quite large, preventing the typical seller from raising the sums needed to buy in at the senior sale to protect a junior security interest. “The only possible protection available to the vendor other than careful and sometimes fortuitous choice of purchasers, is to allow a deficiency judgment against the commercial developer.” (7 Cal.3d at p. 614.)

The second purpose of section 580b identified in Roseleaf is prevention of aggravation of a depression in land values by not burdening purchasers with loss of their land and personal liability. The Spangler court concluded that this purpose has “little applicability to a sold-out junior lienor in the subordination clause context. If section 580b is applied to prevent the deficiency judgment, then the subordinating sold-out junior lienor loses both the land and the purchase price. If section 580b is not applied then the purchaser is subjected to the same burden. Neither party has the land in this context; the sole question is who shall bear the cost of the unpaid portion of the purchase price.” (7 Cal.3d at p. 614.)

Based on this analysis, the court held: “We, therefore, conclude that when in the sale of real property for commercial development, the vendor pursuant to the agreement of sale, subordinates his purchase money lien to the lien securing the purchaser-developer’s construction loan and thereafter, upon the default of the purchaser-developer, loses his security interest after sale or foreclosure under the senior lien, section 580b should not be applied to bar recovery by the junior vendor lienor of the unpaid balance of the purchase price of the property.” (Spangler, supra, 7 Cal.3d at p. 614, fn. omitted.)

*1064The Hamey respondents cite Boyle v. Sweeney (1989) 207 Cal.App.3d 998 [255 Cal.Rptr. 153] and Shepherd v. Robinson (1981) 128 Cal.App.3d 615 [180 Cal.Rptr. 342] to support their position that a major change in use of the property is sufficient to render the transaction nonstandard, and therefore outside the protection of section 580b. But in each of those cases, the seller’s second trust deed was subordinated to a senior lien. This brings the cases squarely within the Spangler exception to section 580b and distinguishes them from our case.

We turn next to an examination of Budget Realty, Inc. v. Hunter, supra, 157 Cal.App.3d 511 (Budget) in light of these principles. The court in Budget distinguished Spangler because there was no actual subordination of the seller’s trust deed. Budget sold commercial property to Martin Hunter and Linda Rubin (buyers). Buyers paid a portion of the purchase price in cash, assumed an existing first trust deed, and gave Budget a second deed of trust for the balance of the purchase price. Budget agreed to subordinate its lien up to $400,000 of construction financing, but the buyers did not obtain construction financing, so the subordination provision was not exercised. There is no discussion in Budget of the buyers’ intended use of the property.

Buyers defaulted on the senior lien debt, and the senior lienholder foreclosed, extinguishing Budget’s second trust deed. Budget sued buyers on the note. The Court of Appeal affirmed the trial court’s grant of summary judgment to the buyers based on the defense of section 580b.

The Budget court reviewed the landmark cases of Brown v. Jensen, supra, 41 Cal.2d 193 and Spangler. “The more convincing rationale of Spangler is the equitable analysis of the effect the variant transaction has on the seller’s security. The subordination of a seller’s purchase money lien to construction financing exposes the seller to unique risks. Construction financing is extremely short-term financing. Further, the amount financed for construction of improvements generally dwarfs the value of the land. Thus, for a seller to salvage his position from the foreclosing construction lender, the seller must pay a ‘balloon payment’ typically exceeding the entire value of the land he sold. Permanent or interim ‘take out’ financing is not accessible until the project is substantially completed. Further, the costs of the improvements are reflected only fractionally in the project’s value until the improvements are substantially completed. A half-completed office building generally does not have one-half the market value of a completed office building. Subordination to construction financing substantially aggravates the jeopardy to the seller’s security.” (157 Cal.App.3d at p. 516.)

The Budget court distinguished the case before it from the transaction in Spangler, focusing on when the jeopardy to the seller’s security is aggravated. It observed “[i]n other commercial contexts, as in the case before us, *1065the seller’s opportunity to cure a default under the senior loan is a more real one. Under Civil Code section 2924, the junior lienholder can cure a default in a payment under the senior loan within three months of notice of the default. With the seller’s opportunity to cure the default of a single payment prior to acceleration of the entire senior debt, the buyer does not really subject the property to any additional jeopardy. The additional jeopardy to the security arises only after the actual subordination.” (157 Cal.App.3d at pp. 516-517.)

The court concluded: “By examining the additional jeopardy the purchase money security is exposed to, we focus on the substance of the subordination transaction. If the simple presence of a subordination clause takes a transaction outside 580b protection, a seller could insert an agreement accepting subordination of his purchase money mortgage to a $1 construction loan. To create absurd forms that effect waiver where the Legislature does not allow explicit waiver is undesirable. If the Legislature determines that commercial transactions should be outside 580b application, the Legislature could amend 580b to apply only to residential transactions. Explicit negotiations in commercial contexts might be desirable. However, imposition of personal liability should not turn on form, but rather should be imposed with additional risk to the seller’s security. Accordingly, in the circumstances of this case, additional risk to the security is effected on exercise of the subordination clause and not by mere presence of the clause.” (Budget, supra, 157 Cal.App.3d at p. 517.)

We agree with the Budget court’s reasoning. Here, PSC remained holder of the first trust deed. It is not a sold-out junior lienholder, and did not subordinate its interests to any other obligation because construction financing was never obtained. Therefore, Spangler and its progeny are distinguishable.

Thompson v. Allert (1991) 233 Cal.App.3d 1462 [285 Cal.Rptr. 367] is also instructive. In that case, the vendors sold an apartment complex to a buyer with the knowledge that the buyer intended to renovate the property. The buyer financed the transaction with a loan from a lending institution secured by a first deed of trust, and gave the sellers notes secured by second and third deeds of trust on the property. In recognition of the buyer’s plan to refinance in order to renovate, the sellers agreed to subordinate their second deed of trust to a new first deed if their third deed of trust was paid. The buyer made renovations and obtained a new loan from Coast Savings and Loan, secured by a new first trust deed, which paid off the existing first and third deeds of trust. The parties recorded a document subordinating the sellers’ second deed of trust to the new first.

*1066The buyer defaulted on the new first trust deed, the lender foreclosed, and the eventual trustee’s sale left no proceeds from which the sellers’ second deed of trust could be satisfied. In the sellers’ action on their second deed of trust, the trial court ruled that section 580b precluded a deficiency judgment and ruled for the buyer.

On appeal, the Thompson court held that the arrangement was a standard purchase money transaction within the meaning of Spangler. It distinguished Spangler: “[The buyer’s] purchase did not contemplate ‘radical improved and changed use of the property.’ Appellants sold him a 33-unit apartment building. When Coast foreclosed, the building still had 33 units. The intervening refinancing is irrelevant because it did nothing more than allow [the buyer] to recover the sums he had already expended in making ‘purely cosmetic’ renovations to the building. Spangler does not make the mere presence of a subordination agreement a push button that defeats the rule of automatic application of section 580b. [Citation.] It is only when a subordination agreement signals a pronounced change in the use to which the property is devoted—thus making it a variation on the standard purchase money security transaction—that the transaction is removed from the reach of the rule. [Citations.] By accepting [the buyer’s] note, appellants extended him credit that was necessary to the consummation of the sale. Appellants retained a deed of trust securing their interest in a building they sold [to the buyer], who was clued as to its true market value. No construction loan is involved. This was, in short, a standard purchase money situation. [Citation.] Knowing the value of their security, appellants assumed the risk that it could, as it did, prove to be inadequate. [Citation.] The trial court was therefore correct in recognizing the automatic application of section 580b.” (233 Cal.App.3d at pp. 1466-1467.)

In our case, PSC held the first trust deed and was not a junior lienholder. PSC obtained judicial foreclosure, and then sought a deficiency judgment for the remaining balance on the secured note. As holder of the first, PSC was not entitled to a deficiency judgment under section 580b. The trial court therefore erred in granting summary judgment to both groups of respondents in this action for legal malpractice on the ground that the defense of section 580b did not apply in the underlying action.

II

The Davis firm also argues that the question of PSC’s entitlement to a deficiency judgment was placed at issue by the allegations of PSC’s cross-complaint. Therefore, it argues it was not obligated to raise section 580b as an affirmative defense. It also contends that it had no continuing duty once the firm was discharged from the case, five months before trial.

*1067“ ‘The formulation of the standard of care is a question of law for the court. [Citations.] Once the court has formulated the standard, its application to the facts of the case is a task for the trier of fact if reasonable minds might differ as to whether the defendants’ conduct has conformed to the standard. [Citations.]’ .... Only if the circumstances permit no reasonable doubt about whether the attorney’s conduct did or did not violate the standard of care, may the court as a matter of law resolve the question whether an attorney breached a duty to clients. [Citations.] In Starr v Mooslin (1971) 14 Cal.App.3d 988, 998 [92 Cal.Rptr. 583], the court stated: ‘ “In any negligence action the existence of a duty of care owed by the defendant to the plaintiff is a question of law for the court. [Citation.] If a duty exists, the complementary degree of care exacted of the defendant—usually that of a reasonable man of ordinary prudence in a like situation—is also declared by law. [Citation.] Breach of duty is usually a fact issue for the jury; if the circumstances permit a reasonable doubt whether the defendant’s conduct violates the boundaries of ordinary care, the doubt must be resolved as an issue of fact by the jury rather than of law by the court.” ’ (Id. at p. 998.) [¶] The standard of care in attorney malpractice is clear ... the crucial inquiry is whether [the defendants’] advice and actions were so legally deficient when given that it demonstrates a failure to use such skill, prudence, and diligence as lawyers of ordinary skill and capacity commonly possess and exercise in performing the tasks they undertake. [Citation.]” (Unigard Ins. Group v. O’Flaherty & Belgum (1995) 38 Cal.App.4th 1229, 1237 (Unigard) [45 Cal.Rptr.2d 565].)

In Unigard, the court reversed a judgment of nonsuit in favor of defendant attorneys in an action for legal malpractice. The basis of the malpractice allegation was the defendants’ failure to allege an affirmative defense based on the exclusive remedy of the Workers’ Compensation Act in a lawsuit for personal injuries. The defendants made an argument similar to that made by the Davis firm here: that they were not required to plead the defense because the complaint affirmatively alleged facts indicating the defense applied. Both the defendants in Unigard and the Davis firm here based their argument on Doney v. Tambouratgis (1979) 23 Cal.3d 91 [151 Cal.Rptr. 347, 587 P.2d 1160]. (38 Cal.App.4th at p. 1238.)

The Unigard court explained why this argument is to no avail. “[E]ven if the Doney exception justifies the failure of the O’Flaherty firm to raise the workers’ compensation defenses in the answer, a question of fact arises as to why the O’Flaherty firm failed to raise these defenses in a demurrer (as authorized by Doney), a summary judgment motion . . . or in some other pleading. The existence of these questions raises sufficient factual dispute to make this a question of fact for the jury.” (38 Cal.App.4th at p. 1239.)

*1068Here, in light of our conclusion that section 580b applied, there are triable issues of material fact as to the liability of both the Davis and the Harney firms for failing to raise the defense of section 580b before the verdict in the underlying action. The trial court erred in granting summary judgment.

Disposition

The judgment is reversed. Appellant is to have his costs on appeal.

Vogel (C. S.), P. J., and Hastings, J., concurred.

A petition for a rehearing was denied August 19, 1998, and respondents’ petition for review by the Supreme Court was denied November 4, 1998. Mosk, J., was of the opinion that the petition should be granted.

Donald W. Shaw acted as trastee of the Donald W. Shaw Revocable Trust.

No issue is made on appeal of the impact of PSC’s failure to complete the environmental cleanup on the deficiency issue, nor do we see one.

We grant the Davis firm’s request that we take judicial notice of the verified first amended cross-complaint filed by PSC and the verified answer filed in the underlying action, pursuant to Evidence Code sections 452, subdivision (d) and 459, subdivision (a).

The declaration of Frank Punelli, Jr'., an attorney in the Davis firm, and a named defendant, in support of the motion for summary judgment, gave a different description of this last amendment. The parties do not make an issue of the discrepancy, which is not material to the disposition of the appeal.

The record does not indicate whether Crookall appealed the judgment in the underlying case.