EXHIBIT 10.31

                             AMENDMENT NO. 1 TO THE
                       MASTER LOAN AND SECURITY AGREEMENT

            Amendment No. 1, dated as of December 11, 2002 (this "Amendment"),
to the Master Loan and Security Agreement, dated as of August 2, 2002 (the
"Existing Loan Agreement", and as amended hereby the "Loan Agreement"), among
American Home Mortgage Corp. and Marina Mortgage Company, Inc. (each a
"Borrower", collectively, the "Borrowers") and Morgan Stanley Bank (the
"Lender").

                                    RECITALS

            The Borrowers and the Lender are parties to the Existing Loan
Agreement. Capitalized terms used but not otherwise defined herein shall have
the meanings given to them in the Existing Loan Agreement.

            The Borrowers and the Lender have agreed, subject to the terms and
conditions of this Amendment, that the Existing Loan Agreement be amended to add
certain interest-only Mortgage Loans as a type of Eligible Mortgage Loan and to
reflect certain other agreed upon revisions to the terms of the Existing Loan
Agreement.

            Accordingly, the Borrowers and the Lender hereby agree, in
consideration of the mutual premises and mutual obligations set forth herein,
that the Existing Loan Agreement is hereby amended as follows:

SECTION 1.  Amendments.

            (a) Section 1.01 of the Existing Loan Agreement is hereby amended by
deleting the definition of "Applicable Collateral percentage" in its entirety
and substituting in lieu thereof the following new definition:

            "'Applicable Collateral Percentage' shall mean, with respect to each
      Eligible Mortgage Loan, the applicable collateral percentage set forth in
      the chart below opposite the applicable type of Mortgage Loan:

           ----------------------------------------------------------------
                                                  Applicable Collateral
                 Type of Mortgage Loan                  Percentage
           ----------------------------------------------------------------

             Agency Eligible Mortgage Loan                     97%
           ----------------------------------------------------------------

              Alternate 'A' Mortgage Loan                      96%
           ----------------------------------------------------------------

            Conduit Eligible Mortgage Loan                     97%
           ----------------------------------------------------------------

             Interest-Only Mortgage Loans                      97%
           ----------------------------------------------------------------


            (b) Section 1.01 of the Existing Loan Agreement is hereby amended by
deleting the definition of "Collateral Value" in its entirety and substituting
in lieu thereof the following new definition:

            "Collateral Value" shall mean, with respect to each Eligible
Mortgage Loan, the lesser of (a) the Applicable Collateral Percentage of the
Market Value of such Mortgage Loan, and (b) 100% of the outstanding principal
balance of such Mortgage Loan; provided, that the following additional
limitations shall apply:

            (i) The aggregate Collateral Value of all Alternate `A' Mortgage
      Loans included in the Borrowing Base at any time shall not exceed 25% of
      the Maximum Credit at such time;

            (ii) The aggregate Collateral Value of all California Program
      Mortgage Loans included in the Borrowing Base at any time shall not exceed
      $20,000,000;

            (iii) The aggregate Collateral Value of all Interest Only Mortgage
      Loans included in the Borrowing Base at any time shall not exceed
      $30,000,000; and

            (iv) Collateral Value shall be deemed to be zero with respect to
      each Mortgage Loan:

                  (1) in respect of which there is a breach of a representation
            and warranty set forth on Schedule 1 (assuming each representation
            and warranty is made as of the date Collateral Value is determined),

                  (2) in respect of which there is a delinquency in the payment
            of principal and/or interest which continues for a period in excess
            of thirty (30) days (without regard to applicable grace periods),

                  (3) (other than Interest Only Mortgage Loans) which remains
            pledged to the Lender hereunder later than 180 days after the date
            on which it is first included in the Collateral,

                  (4) in respect of any Interest Only Mortgage Loan which
            remains pledged to the Lender hereunder later than 120 days after
            the date on which it is first included in the Collateral,

                  (5) which has been released from the possession of the
            Custodian under the Custodial Agreement for a period in excess of
            eighteen (18) days, or

                  (6) which exceeds the limitation on Collateral Value set forth
            in (i) through (iii) above."

            (c) Section 1.01 of the Existing Loan Agreement is hereby amended by
deleting the definition of "Eligible Mortgage Loan" in its entirety and
substituting in lieu thereof the following new definition:

            "'Eligible Mortgage Loan' shall mean a Mortgage Loan secured by a
first mortgage lien on a one-to-four family residential property (a) as to which
the representations and warranties in Section 6.10 and Part I of Schedule 1
hereof are correct and (b) which is either an Agency Eligible Mortgage Loan, an
Alternate `A' Mortgage Loan, a California Program Mortgage Loan, an Eligible
Cooperative Mortgage Loan, an Interest Only Mortgage Loan, a Jumbo Mortgage
Loan, a MERS Designated Mortgage Loan or a Conduit Eligible Mortgage Loan;
provided, that in no event shall any Eligible Mortgage Loan be a security for
purposes of any securities or blue sky laws."

            (d) Section 1.01 of the Existing Loan Agreement is hereby amended by
inserting the following new definition in alphabetical order:

            "'Interest-Only Mortgage Loan' shall mean a Mortgage Loan that is in
strict compliance with the requirements in the Underwriting Guidelines for
"One-Month and Six-Month Interest Only ARM Products" (as defined in the
Underwriting Guidelines)."

            SECTION 2. Conditions Precedent. This Amendment shall become
effective on the date (the "Amendment Effective Date") on which the following
conditions precedent shall have been satisfied:

            2.1 Delivered Documents. On the Amendment Effective Date, the Lender
shall have received the following documents, each of which shall be satisfactory
to the Lender in form and substance:

            (a) Amendment. This Amendment, executed and delivered by a duly
authorized officer of each Borrower and the Lender;

            (b) RFC Notice Requirement. A certificate from the Borrowers
indicating compliance with the notice requirement with respect to additional
lines of credit contained in the Warehouse Credit and Security Agreement dated
as of December 28, 2001 among American Home Mortgage Corp., Marina Mortgage
Company, Inc. and Residential Funding Corporation or a waiver of such
requirement; and

            (c) Other Documents. Such other documents as the Lender or counsel
to the Lender may reasonably request.

                  2.2 No Default. On the Amendment Effective Date, (i) the
Borrowers shall be in compliance with all the terms and provisions set forth in
the Existing Loan Agreement on its part to be observed or performed, (ii) the
representations and warranties made and restated by the Borrowers pursuant to
Section 3 of this Amendment shall be true and complete on and as of such date
with the same force and effect as if made on and as of such date, and (ii) no
Default or Event of Default shall have occurred and be continuing on such date.

            SECTION 3. Representations and Warranties. Each Borrower hereby
represents and warrants to the Lender that it is in compliance with all the
terms and provisions set forth in the Loan Documents on its part to be observed
or performed, and that no Default or Event of Default has occurred or is
continuing, and hereby confirms and reaffirms the representations and warranties
contained in Section 6 of the Existing Loan Agreement.

            SECTION 4. Limited Effect. Except as expressly amended and modified
by this Amendment, the Existing Loan Agreement shall continue to be, and shall
remain, in full force and effect in accordance with its terms; provided,
however, that reference therein and herein to the "Loan Documents" shall be
deemed to include, in any event, (i) the Existing Loan Agreement, (ii) this
Amendment, (iii) the Note, (iii) the Custodial Agreement, (iv) the Electronic
Tracking Agreement and (v) the Parent Guarantee. Each reference to the Loan
Agreement in any of the Loan Documents shall be deemed to be a reference to the
Loan Agreement as amended hereby.

            SECTION 5. Counterparts. This Amendment may be executed by each of
the parties hereto on any number of separate counterparts, each of which shall
be an original and all of which taken together shall constitute one and the same
instrument.

            SECTION 6. GOVERNING LAW. THIS AMENDMENT SHALL BE GOVERNED BY, AND
CONSTRUED IN ACCORDANCE WITH, THE LAW OF THE STATE OF NEW YORK WITHOUT REFERENCE
TO THE CHOICE OF LAW PROVISIONS THEREOF.
<PAGE>


            IN WITNESS WHEREOF, the parties hereto have caused this Amendment to
be duly executed and delivered as of the day and year first above written.


                                     BORROWER


                                     AMERICAN HOME MORTGAGE CORP.


                                     By: /s/ Richard D. Silver
                                         ---------------------------
                                         Name:  Richard D. Silver
                                         Title: Senior Vice President-Treasurer


                                     MARINA MORTGAGE COMPANY, INC.


                                     By: /s/ Richard D. Silver
                                         ---------------------------
                                         Name:  Richard D. Silver
                                         Title: Senior Vice President-Treasurer
<PAGE>


                                     LENDER


                                     MORGAN STANLEY  BANK


                                     By: /s/ Christian B. Malone
                                         ---------------------------
                                         Name:  Christian B. Malone
                                         Title: Vice President