EXHIBIT 10.4

                                 AMENDMENT NO. 6
                           TO THE AMENDED AND RESTATED
                       MASTER LOAN AND SECURITY AGREEMENT

            Amendment No. 6, dated as of September 27, 2004 (this "Amendment"),
to the Amended and Restated Master Loan and Security Agreement, dated as of
November 26, 2003 (as amended, restated, supplemented or otherwise modified
prior to the date hereof, the "Existing Loan Agreement"; as amended, hereby and
as further amended, restated, supplemented or otherwise modified and in effect
from time to time, the "Loan Agreement"), by and among American Home Mortgage
Corp. ("AHMC"), AMERICAN HOME MORTGAGE INVESTMENT CORP. ("AHM Investment"),
AMERICAN HOME MORTGAGE HOLDINGS, INC. ("AHM Holdings"), AMERICAN HOME MORTGAGE
ACCEPTANCE, INC. ("AHM Acceptance"), and AMERICAN HOME MORTGAGE SERVICING, INC.,
formerly known as Columbia National, Incorporated ("AHM Servicing" and together
with AHMC, AHM Investment, AHM Holdings and AHM Acceptance, collectively, the
"Borrowers", each, a "Borrower"), the lenders from time to time parties thereto
(the "Lenders") and Morgan Stanley Bank, as agent for the Lenders (in such
capacity, the "Agent"). Capitalized terms used but not otherwise defined herein
shall have the meanings given to them in the Existing Loan Agreement.

                                    RECITALS

            The Borrowers have requested that the Lenders agree to amend the
Existing Loan Agreement to extend the Termination Date from September 30, 2004
to September 26, 2005 and to effect certain other changes, as set forth in this
Amendment. The Lenders are willing to agree to such amendment, but only on the
terms and subject to the conditions set forth herein.

            NOW, THEREFORE, in consideration of the premises and for other good
and valuable consideration, the receipt and sufficiency of which is hereby
acknowledged, the Borrowers, the Lenders and the Agent hereby agree as follows:

            SECTION 1. Amendments.

            (a) The table of contents in the Existing Loan Agreement is hereby
amended by adding in proper numerical order the following reference to Schedule
8:

                "Schedule 8 Leverage Calculations"

            (b) Section 1.01 of the Existing Loan Agreement is hereby amended by
inserting in proper alphabetical order the following new defined terms:

                "'Recognized Assets' shall mean, at any time, the total amount
         of recognized assets of the Borrowers, determined in accordance with
         the calculations set forth in respect thereof on Schedule 8 hereto."

                "'Sixth Amendment' shall mean that certain Amendment No. 6 and
         Agreement, dated as of September 27, 2004, by and among the Borrowers,
         the Lender and the Agent."




                "'Sixth Amendment Effective Date' shall mean the "Amendment
         Effective Date", as defined in the Sixth Amendment."

                "'Total Liabilities' shall mean, at any time, the total amount
         of liabilities of the Borrowers, determined in accordance with GAAP on
         a consolidated basis."

            (c) 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:


            -------------------------------------------------------------------
                  Type of Mortgage Loan       Applicable Collateral Percentage
            -------------------------------------------------------------------
              Agency Eligible Mortgage Loan                98.0%
               Alternate 'A' Mortgage Loan                 97.0%
             Conduit Eligible Mortgage Loan                97.0%
               Interest-Only Mortgage Loan                 97.0%"
            -------------------------------------------------------------------

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

                "'Applicable Margin' shall mean 70 basis points (0.70%) per
         annum."

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

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

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

                "(iii) The aggregate Collateral Value of all Interest-Only
         Mortgage Loans with an LTV greater than 80% and less than or equal to
         95% included in the Borrowing Base at any time shall not exceed
         $50,000,000;"

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


                                      -2-


                "'Termination Date' shall mean September 26, 2005 or such
         earlier date on which this Loan Agreement shall terminate in accordance
         with the provisions hereof or by operation of law."

            (h) Section 3.04 of the Existing Loan Agreement is hereby deleted in
its entirety and the following shall be inserted in lieu thereof:

                "3.04 Minimum Usage Fee. If, as tested on the first Business Day
         of each fiscal quarter, the average principal balance of the Loans
         outstanding hereunder ("Average Usage") during the immediately
         preceding fiscal quarter shall be an amount less than $120,000,000, the
         Borrowers hereby agree to pay to the Agent, for the account of the
         Lenders, a minimum usage fee ("Minimum Usage Fee"), computed at the
         rate of 70 basis points (0.70%) per annum on the amount equal to the
         difference between the Maximum Credit and the Average Usage, in each
         case payable quarterly in arrears on the first Business Day of the
         following fiscal quarter and on the Termination Date, such payment to
         be made in dollars in immediately available funds, without deduction,
         set-off or counterclaim, to the Agent at the account set forth in
         Section 3.01(a) hereof."

            (i) Section 6.01 of the Existing Loan Agreement is hereby deleted in
its entirety and the following shall be inserted in lieu thereof:

                "6.01 Legal Name. On the Sixth Amendment Effective Date, the
         exact legal name of the each Borrower is, and during the four months
         immediately preceding the date hereof, such name has been,
         respectively, American Home Mortgage Corp., American Home Mortgage
         Investment Corp., American Home Mortgage Holdings, Inc., American Home
         Mortgage Acceptance, Inc. and in the case of AHM Servicing such legal
         name is American Home Mortgage Servicing, Inc. on the date hereof and
         has also been Columbia National, Incorporated during the four months
         immediately preceding the Sixth Amendment Effective Date; and no
         Borrower has used any previous names, assumed names or trade names
         except as set forth on Schedule 4 attached hereto."

            (j) Section 7.08 of the Existing Loan Agreement is hereby deleted in
its entirety and the following shall be inserted in lieu thereof:

                "7.08 Reports.

                (a) The Borrowers shall provide the Agent with a monthly
         production report, which shall include a summary of all loans closed by
         the Borrowers and all loan applications approved by the Borrowers
         during the preceding calendar month."

                (b) The Borrowers shall provide the Agent with a quarterly
         report, which report shall include, among other items, a summary of the
         Borrower's delinquency and loss experience with respect to mortgage
         loans serviced by the Borrowers, any Servicer or any designee of
         either, plus any such additional reports as the Agent may reasonably
         request with respect to the Borrowers' or any Servicer's servicing
         portfolio or pending originations of mortgage loans."

            (k) Section 8(p) of the Existing Loan Agreement is hereby deleted in
its entirety and the following shall be inserted in lieu thereof:

                                      -3-


                "Tangible Net Worth of AHM Investment shall at any time be less
         than the sum of $500,000,000 plus 50% of net proceeds from the issuance
         of any equity securities of AHM Investment or any of AHM Investment's
         consolidated Subsidiaries."

            (l) Section 8(q) of the Existing Loan Agreement is hereby deleted in
its entirety and the following shall be inserted in lieu thereof:

                  "The amount of Recognized Assets shall at any time be less
      than the amount of Total Liabilities."

            (m) The Existing Loan Agreement is hereby amended by deleting
Schedule 3 to the Existing Custodial Agreement in its entirety and substituting
in lieu thereof the Schedule 3 attached hereto.

            (n) The Existing Loan Agreement is hereby amended by deleting
Schedule 4 to the Existing Custodial Agreement in its entirety and substituting
in lieu thereof the Schedule 4 attached hereto.

            (o) The Existing Loan Agreement is hereby amended by inserting in
proper numerical order Schedule 8 attached hereto.

            SECTION 2. Conditions Precedent. This Amendment and its provisions
shall become effective on the first date (the "Amendment Effective Date") on
which all of the following conditions precedent shall have been satisfied, and
upon satisfaction of such conditions precedent the Amendment Effective Date
shall be the date of this Amendment:

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

            (a) Amendment. This Amendment, executed and delivered by a duly
authorized officer of each of the Borrowers, the Lenders and the Agent;

            (b) Amendment to Custodial Agreement. An amendment to the Custodial
Agreement providing for a revised Annex 1, executed and delivered by a duly
authorized officer of each of the Borrowers, the Custodian and the Agent;

            (c) Secretary's Certificates of Borrowers. A certificate of the
Secretary or Assistant Secretary of each Borrower, substantially in the form of
Exhibit A hereto, dated as of the date hereof, and

                (i) attaching certificates dated as of a recent date from the
         Secretary of State or other appropriate authority, evidencing the good
         standing of such Borrower in the jurisdiction of its organization,

                (ii) attaching a copy of the resolutions, in form and substance
         satisfactory to the Agent, of the Board of Directors of such Borrower
         authorizing (A) the execution, delivery and performance of this
         Amendment, and (B) the borrowings contemplated under the Loan
         Agreement,

                                      -4-


                (iii) attaching certified copies of the charter and by-laws (or
         equivalent documents) and all amendments thereto of such Borrower,
         which are in full force and effect as of the date hereof, and

                (iv) certifying as to the incumbency and specimen signature of
         each officer executing this Amendment;

            (d) Legal Opinions. Legal opinions of counsel to the Borrowers; and

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

            2.2 Facility Fee. On or before the Amendment Effective Date, the
Agent shall have received for the account of the Lenders payment from the
Borrowers of an amount equal to 10 basis points (0.10%) times the Maximum
Credit, such payment to be made in Dollars, in immediately available funds,
without deduction, set-off or counterclaim, to the account specified in Section
3.01(a) of the Loan Agreement.

            2.3 Consents, Licenses, Approvals, etc. On or before the Amendment
Effective Date, the Agent shall have received copies certified by the Borrowers
of all consents, licenses and approvals, if any, required in connection with the
execution, delivery and performance by the Borrowers of, and the validity and
enforceability of, the Loan Documents, which consents, licenses and approvals
shall be in full force and effect.

            2.4 No Default. On the Amendment Effective Date, upon giving effect
to the provisions hereof and other than as subject to the Waiver, (i) each
Borrower shall be in compliance with all the terms and provisions set forth in
the Existing Loan Agreement and the other Loan Documents on its part to be
observed or performed, (ii) the representations and warranties made and restated
by each Borrower 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 (iii) 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 Agent and the Lenders, as of the date hereof and
as of the Amendment Effective Date, that, upon giving effect to the provisions
hereof and other than as subject to the Waiver, 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 Loan Agreement.

            SECTION 4. Limited Effect. Except as expressly amended and modified
by this Amendment, the Existing Loan Agreement and each of the other Loan
Documents shall continue to be, and shall remain, in full force and effect in
accordance with its respective terms; provided, however, that upon the Amendment
Effective Date, each reference therein and herein to the "Loan Documents" shall
be deemed to include, in any event, this Amendment and 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.

                                      -5-


            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. Delivery of an executed counterpart of a signature page to this
Amendment in Portable Document Format (PDF) or by facsimile transmission shall
be effective as delivery of a manually executed original counterpart thereof.

            SECTION 6. GOVERNING LAW. THIS AMENDMENT SHALL BE GOVERNED BY, AND
CONSTRUED AND INTERPRETED IN ACCORDANCE WITH, THE LAWS OF THE STATE OF NEW YORK.


                               [SIGNATURES FOLLOW]




            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.


                                       BORROWERS
                                       ---------

                                       AMERICAN HOME MORTGAGE CORP.


                                       By:  /s/ Craig Pino
                                          ------------------------------------
                                          Name:  Craig Pino
                                          Title: SVP


                                       AMERICAN HOME MORTGAGE INVESTMENT CORP.


                                       By:  /s/ Craig Pino
                                          ------------------------------------
                                          Name:  Craig Pino
                                          Title: SVP


                                       AMERICAN HOME MORTGAGE HOLDINGS, INC.


                                       By:  /s/ Craig Pino
                                          ------------------------------------
                                          Name:  Craig Pino
                                          Title: SVP


                                       AMERICAN HOME MORTGAGE ACCEPTANCE, INC.


                                       By:  /s/ Craig Pino
                                          ------------------------------------
                                          Name:  Craig Pino
                                          Title: SVP


                                       AMERICAN HOME MORTGAGE SERVICING, INC.
                                          (f/k/a Columbia National,
                                          Incorporated)


                                       By:  /s/ Craig Pino
                                          ------------------------------------
                                          Name:  Craig Pino
                                          Title: SVP


                                 AMENDMENT NO. 6



                                       AGENT AND LENDER
                                       ----------------

                                       MORGAN STANLEY BANK



                                       By:  /s/ Paul Najarian
                                          ------------------------------------
                                          Name: Paul Najarian
                                          Title: Vice President


                                 AMENDMENT NO. 6




                                                                       Exhibit A
                                                                       ---------

                         Form of Secretary's Certificate


            Pursuant to Section 2.1(c) of that certain Amendment No. 6, dated as
of September 27, 2004 (the "Sixth Amendment"), to the Amended and Restated
Master Loan and Security Agreement, dated as of November 26, 2003 (as amended,
restated, supplemented or otherwise modified prior to the date hereof, the
"Existing Loan Agreement"; as amended by the Sixth Amendment and as further
amended, restated, supplemented or otherwise modified and in effect from time to
time, the "Loan Agreement"; capitalized terms used but not otherwise defined
herein shall have the meanings assigned thereto by the Loan Agreement), by and
among AMERICAN HOME MORTGAGE CORP. ("AHMC"), AMERICAN HOME MORTGAGE INVESTMENT
CORP. ("AHM Investment"), AMERICAN HOME MORTGAGE HOLDINGS, INC. ("AHM
Holdings"), AMERICAN HOME MORTGAGE ACCEPTANCE, INC. ("AHM Acceptance"), and
AMERICAN HOME MORTGAGE SERVICING, INC., formerly known as Columbia National,
Incorporated ("AHM Servicing" and together with AHMC, AHM Investment, AHM
Holdings and AHM Acceptance, collectively, the "Borrowers", each, a "Borrower"),
the lenders from time to time parties thereto (the "Lenders") and MORGAN STANLEY
BANK, as agent for the Lenders (in such capacity, the "Agent"), the undersigned
hereby certifies on behalf of [AHMC / AHM Investment / AHM Holdings / AHM
Acceptance / AHM Servicing] (the "Specified Borrower") as follows:

            (a) Attached hereto as "Annex A" is an original certificate dated as
of a recent date from the Secretary of State or other appropriate authority
evidencing the good standing of the Specified Borrower in its jurisdiction of
organization;

            (b) Attached hereto as "Annex B" is a true, correct and complete
copy of the resolutions of the Specified Borrower, together with any and all
amendments thereto, authorizing the execution, delivery and performance of the
Sixth Amendment and the borrowings contemplated under the Loan Agreement, such
resolutions having not been amended, modified, revoked or rescinded, and the
same being in full force and effect in the attached form as of the date hereof;

            (c) Attached hereto as "Annex C" is a true, correct and complete
copy of the Certificate of Incorporation of the Specified Borrower and all
amendments thereto, which is in full force and effect in the attached form as of
the date hereof, and no amendment or other document relating to or affecting the
Certificate of Incorporation has been filed with the Secretary of State of the
State of Delaware since ___________, 20__, and no action has been taken by the
Specified Borrower, its stockholders or directors in connection with the filing
of such amendment or other document;

            (d) Attached hereto as "Annex D" is a true, correct and complete
copy of the By-laws of the Specified Borrower and all amendments thereto, which
are in full force and effect in the attached form as of the date hereof, and
such By-laws are the only by-laws of the Specified Borrower and were in full
force and effect at all times from ___________, 20__, through the date hereof
and have not otherwise been revoked, rescinded or modified, and no amendment to
the By-laws has been authorized by the stockholders or directors of the
Specified Borrower; and




            (e) The following named individuals are duly elected, qualified and
acting officers of the Specified Borrower, each such individual holding the
office(s) set forth opposite his respective name as of the date hereof, and the
signatures set forth beside the respective name and title of said officers and
authorized signatories are true, authentic signatures:


Name                                  Title                    Signature
- ----                                  -----                    ---------

Michael Strauss             President and Chief
                            Executive Officer             ______________________

Stephen A. Hozie            Executive Vice President
                            and Chief Financial
                            Officer                       ______________________

Alan Horn                   Executive Vice President
                            and General Counsel, and
                            Secretary                     ______________________

Craig Pino                  Senior Vice President and
                            Treasurer                     ______________________


                               [Signatures Follow]


                                       A-2



            IN WITNESS WHEREOF, the undersigned has hereunto executed this
Secretary's Certificate as of this ___ day of September, 2004.



                                    By:_______________________________________
                                       Name:  Alan Horn
                                       Title: Executive Vice President, General
                                              Counsel and Secretary


The undersigned, Stephen A. Hozie, does hereby certify that he is the duly
elected and presently incumbent Executive Vice President and Chief Financial
Officer of the Specified Borrower and in such capacity does hereby certify to
the Lender that Alan Horn is the duly elected and presently incumbent Secretary
of the Specified Borrower.



                                    By:_______________________________________
                                       Name:  Stephen A. Hozie
                                       Title: Executive Vice President and
                                              Chief Financial Officer


                                       A-3



                                   Schedule 3

                                  SUBSIDIARIES
                                  ------------

                                 [See attached]




                                   Schedule 4

                              Borrower Trade Names
                              --------------------

                                 [See attached]



                                   Schedule 8

                              Leverage Calculations
                              ---------------------

                                 [See attached]