
190 Cal.App.3d 1051 (1987)
235 Cal. Rptr. 813
RONALD B. BRUCKMAN, Plaintiff, and Respondent,
v.
PARLIAMENT ESCROW CORPORATION, Defendant and Appellant.
Docket Nos. B016901, B020353.
Court of Appeals of California, Second District, Division Six.
March 31, 1987.
*1054 COUNSEL
Davis & Davis and M. Stephen Davis for Defendants and Appellants.
Mathews & Evans and Vicki W. Perkowitz for Plaintiff and Respondent.
*1055 OPINION
STONE, P.J.
Parliament Escrow Corporation (Parliament) appeals from a judgment in favor of Ronald Bruckman (Bruckman) for $8,297.01, plus interest of $3,216.21, costs of $531.13, and attorney's fees of $16,022.25. Parliament contends that: (1) Bruckman's claims were barred by the statute of limitations; (2) the trial court could not award attorney's fees pursuant to Civil Code section 1717 for an action based on negligence; (3) the amount of attorney's fees awarded was uncertain and unreasonable; (4) Bruckman was not entitled to indemnity from Parliament; and (5) the trial court's finding a breach of contract was erroneous. We find no error and affirm the judgment.

FACTS
In January 1977, Bruckman and Su opened an escrow with Parliament for the sale of Su's lot 197 in Oxnard, California to Bruckman, this escrow to close April 13, 1977 and contingent on Bruckman's selling his lot 831 (that contingency would be waived if Bruckman failed to notify the escrow agent to the contrary by Feb. 10, 1977). Supplemental escrow instructions signed by Bruckman authorized Parliament to use the proceeds from the sale of lot 831 to fund the purchase of lot 197.
Alan Smotkin offered to buy lot 831 contingent upon his obtaining a construction loan. Bruckman did not accept the offer, but by February 15, 1977, Bruckman and Smotkin opened escrow with Parliament based upon an all cash offer of $30,000. The Bruckman/Smotkin escrow provided that the escrow was contingent upon buyer's approval of the preliminary title report within five days from date of receipt of such report, which date of receipt was to be the date shown on receipt for certified mail, and that failure of buyer to disapprove said report in writing in five days would constitute buyer's approval.
Also, the escrow was to close concurrently with the Bruckman/Su escrow and Parliament was to obtain and pay the demand of the holder of the deed of trust of record for full reconveyance. The escrow agreement provided that time was of the essence, but if escrow could not close on or before the date set forth, Parliament was to close it as soon as possible thereafter, unless written notice of cancellation was given by either party.
There was no provision in the Bruckman/Smotkin agreement that escrow was contingent upon any construction loan. Nonetheless, Smotkin, who had applied for a construction loan, instructed escrow officer, Jean Meyer, who was handling both Bruckman escrows, to send copies of all escrow instructions *1056 to the lending institution. Smotkin was also attempting to obtain certain tax-deferred benefits in exchanging the purchase of lot 831 in connection with another escrow at Safeco Title.
The escrow officer did not order a title report until March 29, did not mail it until April 12, the day before escrow was to close, and did not obtain a return receipt as specified in the escrow instructions. Parliament received a letter from Su, dated April 8, on April 12 that Parliament take no further action without Su's consent, if the Bruckman/Su escrow did not close on or before April 13, 1977. Although the memorandum sent with the preliminary title report to Smotkin on April 12th requested that he advise the exact manner in which title was to vest (apparently he had changed his mind several times), there was no request that Smotkin deposit funds necessary to close escrow. Smotkin wrote Parliament on April 13th that he had not received the preliminary title report.
Neither escrow closed April 13th and the Bruckman/Su escrow was cancelled by Su's letter of April 8th. On April 19, 1977, Smotkin filed a specific performance action against Bruckman and a lis pendens against lot 831. Notwithstanding his suit, Smotkin treated the escrow as being active, directed Parliament how title should be vested, obtained a construction contract for a two-story house, had Parliament mail copies of escrow instructions to California Federal in April and May, had the lot appraised, and directed Parliament to disregard previous vesting instructions and vest title in Alan M. Smotkin and Michele S. Smotkin, as trustees of the Smotkin Family Trust, but did not deposit any funds in escrow. May 15, 1977, Bruckman wrote Parliament, instructing them to cancel escrow since he had been unsuccessful in his repeated requests to Smotkin to deposit funds in escrow.
Smotkin proceeded with his suit against Bruckman and sought to excuse his failure to deposit money on the basis that he had never been sent a copy of the preliminary title report and had never been requested to deposit funds, nor advised how much money to deposit. Bruckman contended that he had fulfilled all his obligations under the escrow but that Smotkin failed to deposit the requisite money. Bruckman cross-complained against Smotkin and also against Su. The cause of action against Su was later dropped. After a three-day trial in March 1981, the court granted judgment in favor of Bruckman on Smotkin's action, expunged the lis pendens and imposed $2,500 in attorney's fees on Smotkin, apparently under the authority of Code of Civil Procedure section 409.3. On Bruckman's cross-complaint, the court found Smotkin not guilty of fraud and not liable for damages for Bruckman's loss of the purchase of lot 197. Bruckman recovered his costs.
*1057 January 28, 1981, Bruckman filed a complaint for "Negligence, Breach of Fiduciary Duty and Indemnity" against Parliament alleging damages due in loss of purchase of lot 197 and in expenses incurred in Smotkin's lawsuit, all due to Parliament's negligent and careless handling of the Bruckman/Smotkin escrow. Parliament, in its answer, alleged that Bruckman's suit was barred by the statutes of limitations set forth in Code of Civil Procedure sections 339, subdivision 1; 338, subdivision 4; and 343.[1] At trial in 1985, Bruckman proceeded primarily on his claim for damages for litigation expenses incurred in defending against Smotkin's lawsuit.
The trial court concluded that Bruckman's action was governed by the four-year statute applicable to actions upon a contract, obligation or liability founded upon an instrument in writing (Code Civ. Proc., § 337, subd. 1.), that "Parliament impliedly promised both Bruckman and Smotkin that it would do all of the things normally done by an escrow agent, which were not expressly excluded by the provisions of the instructions, and that it would do all of these things with reasonable care and with reasonable dispatch to the end that the escrow could be ready to close by the specified date, April 13, 1977," and that Parliament's failure to perform its duties with reasonable care and with reasonable dispatch was a substantial factor in the collapse of the Bruckman/Smotkin escrow and the damages to Bruckman. The court further found it was foreseeable that Parliament's breaches would cause the escrow to collapse and that Smotkin would take the type of action he did. Parliament appeals from both the judgment and from the order after judgment awarding attorney's fees.

DISCUSSION

1. Complaint Not Barred by Statute of Limitations.

(1a) Parliament contends the trial court erred in finding that the four-year limitation of Code of Civil Procedure section 337, subdivision 1 for actions on a contract or obligation founded upon a written instrument governed Bruckman's causes of action rather than the shorter provisions for fraud, mistake, oral contracts, or negligence found in sections 338, 339, subdivision 1, and 340, subdivision (3) (which also does not seem applicable), as all causes of action alleged negligence.
The complaint alleged that Bruckman and Smotkin entered into a written agreement whereby plaintiff agreed to sell to Smotkin and Smotkin agreed to purchase lot 831, said agreement evidenced in the form of escrow instructions executed by plaintiff and Smotkin naming defendant Parliament as *1058 escrow holder. It further alleged that "Defendant Parliament accepted and agreed to serve as escrow holder pursuant to the instructions ..."
The applicable period of limitations for an action based upon the negligent performance of an implied obligation which is based upon a contract in writing is the four-year period prescribed by section 337, subdivision 1, of the Code of Civil Procedure. (United States Liab. Ins. Co. v. Haidinger-Hayes, Inc. (1970) 1 Cal.3d 586, 596 [83 Cal. Rptr. 418, 463 P.2d 770].) (2) An escrow holder must comply strictly with instructions of the parties. (Amen v. Merced County Title Co. (1962) 58 Cal.2d 528, 531 [25 Cal. Rptr. 65, 375 P.2d 33].) "Upon the escrow holder's breach of an instruction that it has contracted to perform or of an implied promise arising out of the agreement with the buyer or seller, the injured party acquires a cause of action for breach of contract. [Citations.] Similarly, if the escrow holder acts negligently, `it would ordinarily be liable for any loss occasioned by its breach of duty.' [Citations.] If the escrow instructions are in writing and the escrow holder accepts them or if the escrow holder prepares the instructions, offers to perform them, and the buyer and seller accept the offer, an action for failure to comply with the instructions is on a written contract. The contract may be `in writing' for purposes of the statute of limitations even though it was accepted orally or by an act other than signing. [Citations.] An action is on a written contract, even though it is based on a promise implied from the writing." (Id., at p. 532.)
(1b) The trial court's finding that Parliament impliedly promised both Bruckman and Smotkin that it would do all of the things normally done by an escrow agent, which were not expressly excluded by the provisions of the instructions, and that the action was founded upon a written instrument was not an abuse of discretion. It was Parliament's negligent performance and failure to comply with the terms of the escrow that was the breach of Parliament's agreement. Bruckman filed his action within four years of the date escrow opened.
Parliament asserts it was prejudiced by Bruckman's delay in filing his action because Jean Meyer died between termination of escrow and trial and that Bruckman could have joined Parliament in the Smotkin action. However, both parties indicate that Jean Meyer died before the Smotkin/Bruckman trial. Thus, we fail to see what difference the timing of the trial herein made.

2. Award of Attorney's Fees Proper.

Parliament contends the award of attorney's fees was unreasonable and erroneous because: (1) Bruckman originally claimed approximately *1059 $100,000 in damages, a claim which he later virtually abandoned, and the court rendered judgment in less than the jurisdictional amount of the court; (2) an award of attorney's fees is improper under Civil Code section 1717 where the action is for negligence (see Stout v. Turney (1978) 22 Cal.3d 718 [150 Cal. Rptr. 637, 586 P.2d 1228]; Chapple v. Big Bear Super Market No. 3 (1980) 108 Cal. App.3d 867 [167 Cal. Rptr. 103]); and (3) Bruckman, having failed to establish by competent evidence the underlying legal services performed and the reasonable value of said service, sought to have the court cure this defect by judicial notice.
Parliament further contends that the court did not consider appropriate factors in establishing reasonable attorney's fees (see Coalition for L.A. County Planning etc. Interest v. Board of Supervisors (1977) 76 Cal. App.3d 241 [142 Cal. Rptr. 766]) and that no fee should be awarded for time spent seeking attorney's fees (see Mandel v. Lackner (1979) 92 Cal. App.3d 747 [155 Cal. Rptr. 269]).

A. Propriety of the Awards.

(3) The escrow agreement provided that: "... All of the parties to this escrow hereby jointly and severally promise and agree to pay promptly on demand, as well as to indemnify you and to hold you harmless from and against all litigation and interpleader costs, damages, judgments, attorney's fees, expenses, obligations and liabilities of every kind which, in good faith, you may incur or suffer in connection with or arising out of this escrow, whether said litigation, interpleader, obligations, liabilities or expenses arise during the performance of this escrow, or subsequent thereto, directly or indirectly."
That provision is made reciprocal to the prevailing party by section 1717 of the Civil Code in any action on that contract. (Reynolds Metals Co. v. Alperson (1979) 25 Cal.3d 124, 128 [158 Cal. Rptr. 1, 599 P.2d 83].) Bruckman's failure to offer to compromise does not affect his right to attorney's fees pursuant to Civil Code section 1717 nor does his recovery of a judgment that could have been rendered in a court of lesser jurisdiction prevent a court's exercising its discretion to award them. (See Code Civ. Proc., § 1033.) The trial court specifically found reasonable Bruckman's filing the action in superior rather than municipal court. We find no abuse of discretion.
Parliament's argument that the action was not tried on a contractual theory is unavailing. In Bruckman's opening statement, his counsel alleged negligence and breach of contract and in Bruckman's trial brief he alleged that losses were incurred by Parliament's negligence and breach of contract.
*1060 (4) Moreover, joinder of causes of action does not dilute the right of attorney's fees. A trial court need not apportion attorney's fees incurred for representation on an issue common to both a cause of action in which fees are proper and one in which they are not allowed. (Reynolds Metals Co., supra, 25 Cal.3d 124, 129-130.) That Bruckman did not entitle his causes of action as breach of contract is not controlling. "No variance between the allegation in a pleading and the proof is to be deemed material, unless it has actually misled the adverse party to his prejudice in maintaining his action or defense upon the merits. Whenever it appears that a party has been so misled, the court may order the pleading to be amended upon such terms as may be just." (Code Civ. Proc., § 469.) "Where the variance is not material, as provided in Section 469 the court may direct the fact to be found according to the evidence, or may order an immediate amendment, without costs." (Code Civ. Proc., § 470.)
(5) That the issues were not pleaded does not preclude their adjudication where a case is tried on the merits, as here, the issues thoroughly explored during trial, and the theory of the trial well known to court and counsel. (Duncan v. Sunset Agricultural Minerals (1969) 273 Cal. App.2d 489, 494 [78 Cal. Rptr. 339].) Moreover, a shifting from one theory of liability to another is not the substitution of a new cause of action when the basic facts are the same. (Youngblood v. City of Los Angeles (1958) 160 Cal. App.2d 481, 489 [325 P.2d 587]; Lambreton v. Industrial Acc. Com. (1956) 46 Cal.2d 498, 513 [297 P.2d 9].) Bruckman did not need to formally request an order to conform to proof since the variance between the breach of contract theory and his causes of action as pleaded was immaterial. Parliament was not misled to its prejudice since the issue  whether Parliament breached its duty by failing to comply with the express and implied terms of the escrow instructions  was the same under either theory of liability, i.e., negligence or breach of contract.

B. Amount of Attorney's Fees Sustainable.

Parliament confuses two different theories upon which Bruckman was awarded attorney's fees. The attorney's fees Bruckman incurred in the Smotkin/Bruckman litigation were awarded as damages. A party aggrieved is entitled to be compensated for breach of contract in the amount which will compensate for all detriment proximately caused thereby, or which, in the ordinary course of things, would be likely to result therefrom. (Civ. Code, § 3300.) (6) Code of Civil Procedure section 1021, which leaves to the agreement of the parties "the measure and mode of compensation of attorneys" is not applicable to cases where a defendant has wrongfully made it necessary for a plaintiff to sue a third person or to defend an action brought by a third person. (Prentice v. North Amer. Title Guar. Corp. (1963) 59 Cal.2d *1061 618, 621 [30 Cal. Rptr. 821, 381 P.2d 645]; Brandt v. Superior Court (1985) 37 Cal.3d 813, 817-818 [210 Cal. Rptr. 211, 693 P.2d 796]; Gray v. Don Miller & Associates, Inc. (1984) 35 Cal.3d 498, 508 [198 Cal. Rptr. 551, 674 P.2d 253, 44 A.L.R.4th 763].) In fact, the Supreme Court in Prentice, supra, specifically held that when an escrow holder has negligently made it necessary for the vendor of land to file a quiet title action against a third person, attorney's fees incurred by the vendor in prosecuting such action are recoverable as an item of the vendor's damages in an action against the escrow holder. (59 Cal.2d 618, 621.)
(7a) The trial court concluded that Parliament's failure to perform its duties was a substantial factor in the collapse of the escrow and it was foreseeable that Smotkin would seek to capitalize on Parliament's errors. Bruckman presented evidence of his damages at trial through exhibits containing statements from his attorneys in that action, cancelled checks and his testimony. At Bruckman's request, the trial court took judicial notice of the pleadings and documents in the file of Smotkin v. Bruckman for the purpose of substantiating his claim of damages and to familiarize the court with the complexity and extent of the litigation. The court specifically declined to take judicial notice of the truth of the matters asserted in the file. We find no error in that procedure. (See Ramsden v. Western Union (1977) 71 Cal. App.3d 873, 879 [138 Cal. Rptr. 426]; Day v. Sharp (1975) 50 Cal. App.3d 904, 914 [123 Cal. Rptr. 918]; 2 Jefferson, Cal. Evidence Benchbook (Cont.Ed.Bar 1982) § 47.2.)
Parliament asserts it was deprived of the right to cross-examine on the documents in the court's file. However, that argument could always be made when the trial court judicially notices a record or document. Moreover, the court has authority to make its own determination. (Genis v. Krasne (1956) 47 Cal.2d 241, 246 [302 P.2d 289].) (8) Uncertainty of the fact whether any damages were sustained is fatal to recovery, but uncertainty as to the amount is not. (Fisher v. Hampton (1975) 44 Cal. App.3d 741, 747-748 [118 Cal. Rptr. 811].) (7b) The court found that considering the total amount claimed, after deduction of fees incurred on pursuing the cross-complaint, the amount was reasonable and that the damages had been proved with reasonable certainty. We agree.
(9) The trial court also found that, based upon the attorney's fees provision in the escrow instructions, Bruckman was entitled to an award of attorney's fees for prosecuting the instant action. That amount was calculated as costs pursuant to noticed motion and hearing after judgment. (Code Civ. Proc., § 1034.) Bruckman submitted his attorney Mathews's declaration wherein Mathews stated that he had reviewed all of the time slips and billings from Bruckman v. Parliament since its inception and a total of 157.52 hours *1062 had been spent for a total sum of $16,022.25. He also set forth a summary of hours and billings, including the amount of hours and charges in all invoices for 1984 through 1985. Billings for 1981 through 1983 came to only 8.15 hours.
At the hearing, Bruckman's attorney testified and was cross-examined concerning the time spent on the instant action. The court disallowed some witness fees to which Parliament objected and, in its order, stated that, "The court believes and accepts the plaintiff's declarations and other evidence relative to the hours spent and finds that the different hourly rates charged are reasonable. The court has also evaluated the total resulting fee, considering all of the factors involved, particularly including the considerable difficulty of the case and the high degree of skill exercised, and concludes that the total of $16,022.25 is no more than reasonable."
Again, we find no abuse of discretion. (10) The matter of reasonableness of attorney's fees is within the sound discretion of the trial judge. (Genis v. Krasne, supra, 47 Cal.2d 241, 246; Schoolcraft v. Ross (1978) 81 Cal. App.3d 75, 82 [146 Cal. Rptr. 57].) Determining the weight and credibility of the evidence, especially credibility of witnesses, is the special province of the trier of fact. (Inwood Laboratories v. Ives Laboratories (1982) 456 U.S. 844, 856 [72 L.Ed.2d 606, 617, 102 S.Ct. 2182].) Contrary to Parliament's contention, it has been held that when an amount of attorney's fees is statutorily authorized, the reasonable expenses of preparing the application for fees should be included in the award. (Brown v. Fairleigh Dickinson University (1983) 560 F. Supp. 391, 414.) Mandel v. Lackner, supra, 92 Cal. App.3d 747, cited by Parliament in support of its contention that such fees are not proper, is distinguishable. Mandel held that where attorney's fees are predicated upon the "substantial benefit" theory in public-interest litigation, a party is not entitled to an additional award of attorney's fees on appeal from an award of attorney's fees since the "substantial benefit" to the public upon which the original award of fees was made is no longer applicable; respondent's attorneys are essentially representing their own interests. (92 Cal. App.3d 747, 760.)

3. Indemnity and Breach of Contract.

(11) Parliament contends Bruckman is not entitled to indemnity because he never made any demand that Parliament undertake his representation or indemnify him in the Smotkin action. (See Code Civ. Proc., § 1021.6.) Parliament did not raise this argument at trial and alleged in its answer only that Bruckman was not entitled to indemnity. Here, damages were based on the express contractual provision in the escrow instructions and not a theory of implied indemnity referred to in Code of Civil Procedure section 1021.6. *1063 Moreover, the damages awarded were based on a finding that they were proximately caused by Parliament's breach and not based upon a cause of action for indemnity.
Parliament also complains sotto voce that "it was necessary for the trial court to go outside of California law to attempt to find authority for its position to conclude that Parliament broke its contract because to do otherwise, would have left the instant action barred by the statute of limitation and Bruckman without attorney's fees." The verity of its observation brings it cold comfort and does not detract from the propriety of the court's conclusions.
The trial court felt that, although Parliament was perhaps not the sole cause of the failure of escrow and Bruckman's ensuing litigation fees, it was a substantial factor. The court looked to section 999 of 5 Corbin on Contracts (1964) which cites Krauss v. Greenbarg (3d Cir.1943) 137 F.2d 569, 572 as applying the substantial factor test to a breach of contract. Two other cases, Nelson v. Lake Canal Co. of Colo. (1981) 644 P.2d 55, 59 and Reiman Assoc., Inc. v. R/A Advertising, Inc. (1981) 102 Wis. 2d 305 [306 N.W.2d 292, 301] also apply Corbin's adoption of this test.
We find the authorities cited persuasive. As stated in Corbin and quoted in Reiman Assoc., Inc., supra, "`In all cases involving problems of causation and responsibility for harm, ... the plaintiffs total injury may have been the result of many factors in addition to the defendant's tort or breach of contract. Must the defendant pay damages equivalent to the total harm suffered? Generally the answer is Yes, even though there were contributing factors other than his own conduct. Must the plaintiff show the proportionate part played by the defendant's breach of contract among all the contributing factors causing the injury, and must his loss be segregated proportionately? To these questions the answer is generally No. (FN12) In order to establish liability the plaintiff must show that the defendant's breach was `a substantial factor' in causing the injury. (Emphasis added, footnotes in original deleted, footnote inserted). FN12. Because of the limiting doctrine of Hadley v. Baxendale, apportionment has not been a concern in contract cases.'" (306 N.W.2d 292, 301.)
The court found that the facts in the instant case argue powerfully for application of the substantial factor test in a contract case, a test which is set forth in BAJI No. 3.76. As the court noted, if any of the parties to an escrow may avoid responsibility by contending that one of the other parties probably would not have performed anyway, the effective force of escrow agreements and the amount of reliance that can be placed on such agreements will be greatly diminished. That result would be contrary to good *1064 social policy. The trial court correctly concluded that Parliament's failure to perform its duties with reasonable care and with reasonable dispatch was a substantial factor in the collapse of the Bruckman/Smotkin escrow and the damages to Bruckman, and that this was a legally sufficient showing of causation.
The judgment and order appealed from are affirmed.
Costs to respondent.
Gilbert, J., and Abbe, J., concurred.
NOTES
[1]  Presumably, Parliament misstated the section as 343 is a four-year statute.
