Exhibit 10.4 NINTH AMENDMENT TO AMENDED AND RESTATED MORTGAGE LOAN WAREHOUSING AGREEMENT This Ninth Amendment to Amended and Restated Mortgage Loan Warehousing Agreement (the "Amendment") is dated as of August 17, 1998, by and among BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION, a national banking association ("BOA"), and the other banks signatory hereto from time to time (each a "Lender" and, collectively, the "Lenders"), BOA as agent for the Lenders (in such capacity, the "Agent") and FIRST MORTGAGE CORPORATION, a California corporation (the "Company"). RECITALS A. Pursuant to that certain Amended and Restated Mortgage Loan Warehousing Agreement dated as of September 1, 1995 by and among BOA, the Agent and the Company (as amended from time to time, the "Agreement"), BOA agreed to extend credit to the Company on the terms and subject to the conditions set forth therein. All capitalized terms not otherwise defined herein shall have the meanings given to such terms in the Agreement. B. The Company and the Lenders desire to amend the Agreement in certain respects, all as set forth more particularly herein. NOW, THEREFORE, in consideration of the foregoing Recitals and for other good and valuable consideration, the receipt and adequacy of which are hereby acknowledged, the parties hereto hereby agree as follows: AGREEMENT 1. Change in Definition of Maturity Date. To reflect the agreement of the parties to extend the Maturity Date, the definition of "Maturity Date" in Paragraph 4 of the Agreement is hereby further amended by replacing "September 1, 1998" with "September 1, 1999." 2. Change in Definition of "Eligible Committed Non-Conforming Mortgage Loan." Clause (g) of the definition of the term "Eligible Committed Non-Conforming Mortgage Loan," set forth in Paragraph 11 of the Agreement, is hereby amended to read in its entirety as follows: "(g) The Collateral Value of said Mortgage Loan when added to the Collateral Value of all Eligible Committed Non-Conforming Mortgage Loans included in the Borrowing Base does not exceed fifty percent (50%) of the Credit Limit and, if the original principal balance of said Mortgage Loan is greater than $750,000, the Collateral Value of said Mortgage Loan, when added to the Collateral Value of all Eligible Committed Non-Conforming Mortgage Loans whose respective original principal balances are greater than $750,000 and are included in the Borrowing Base, does not exceed ten percent (10%) of the Credit Limit; and" 3. Reaffirmation of Security Agreement. The Company hereby affirms and agrees that (a) the execution, delivery and performance by the Company of its obligations under this Amendment shall not in any Way amend, impair, invalidate or otherwise affect any of the obligations of the Company or the rights of the Secured Parties under the Security Agreement or any other document or instrument made or given by the Company in connection therewith, (b) the term "Obligations" as used in the Security Agreement includes, without limitation, the Obligations of the Company under the Agreement as amended hereby, and (c) the Security Agreement remains in full force and effect in that such agreement constitutes a continuing first priority security interest in and lien upon the Collateral. 4. Effective Date. This Amendment shall be effective as of the date (the "Effective Date") upon which: (a) All parties signatory hereto have executed and delivered this Amendment to the Agent; and (b) The Agent has received such board resolutions, incumbency certificates and other additional documentation as it may request in connection herewith. 5. No Other Amendment. Except as expressly amended herein, the Agreement and the other Loan Documents (as amended from time to time) shall remain in full force and effect as currently written. 6. Counterparts. This Amendment may be executed in any number of counterparts, each of which when so executed shall be deemed to be an original and all of which when taken together shall constitute one and the same agreement. 7. Representations and Warranties. The Company hereby represents and warrants to the Agent, the Lenders and the Collateral Agent as follows: (a) The Company has the corporate power and authority and the legal right to execute, deliver and perform this Amendment and all documents, instruments and agreements executed and delivered by the Company in connection therewith (collectively, the "Amendment Documents") and has taken all necessary corporate action to authorize the execution, delivery and performance of the Amendment Documents. The Amendment Documents have been duly executed and delivered on behalf of the Company and constitute legal, valid and binding obligations of the Company, enforceable against the Company in accordance with their respective terms. (b) At and as of the date of execution hereof and at and as of the Effective Date of this Amendment and both prior to and after giving effect to the Amendment Documents: (1) the representations and warranties of the Company contained in the Agreement are accurate and complete in all respects, and (2) there has not occurred an Event of Default or Potential Default under the Agreement. IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be executed as of the day and year first above written. FIRST MORTGAGE CORPORATION A California Corporation By: Name: Clement Ziroli First Mortgage Corporation 3230 Fallowfield Road Diamond Bar, CA 91765 Percentage Shares: 100% BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION, a national banking association as Agent and Lender By: Name: Thomas A. Pizurie Title: Vice President