Exhibit
10.31(d)

AMENDMENT
NO. 2

# TO
THE SECOND AMENDED AND RESTATED

# MASTER
LOAN AND SECURITY AGREEMENT

AMENDMENT
NO. 2, dated as of January 22, 2004 (this Amendment), to the
Second Amended and Restated Master Loan and Security Agreement, dated as of
August 29, 2003 (as previously amended, supplemented or otherwise modified, 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), among AAMES CAPITAL CORPORATION
(Aames Capital), AAMES FUNDING CORPORATION (Aames
Funding, together with Aames Capital, each a
Borrower, collectively, the Borrowers) and
MORGAN STANLEY MORTGAGE CAPITAL INC., formerly known as Morgan Stanley Dean
Witter Mortgage Capital Inc. (the Lender). Capitalized terms
used but not otherwise defined herein shall have the meanings given to them in
the Existing Loan Agreement.

# RECITALS

The
Borrowers and the Lender are parties to 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 shall be amended as set forth below.

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

Section
1. Amendments.

(a)     
Section  11.16 of the  Existing  Loan  Agreement  is hereby  amended by deleting  the
following  sentence  therefrom:

| | It
is understood that, in the case of Class C Defaulted Loans, such underwriting is
expected to occur quarterly with respect to 10-20% of the Class C Defaulted
Loans then included in the Borrowing Base.
| | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(b)      Part
1 to Schedule 1 of the Existing Loan Agreement is hereby amended by  deleting the
representation and warranty set forth in clause (vv) in its  entirety and inserting in
lieu thereof the following new clause (vv):

"(vv)   FICO Score.   The Mortgage Loan does not have a FICO score below 500."

Section
2.Conditions Precedent. This Amendment shall be effective on the first date
that all of the following conditions precedent shall have been satisfied (the
"Amendment Effective Date"):

1

---

2.1     
Delivered Documents. 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 theLender; and

(b)     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) each Borrower 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 (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 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 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 all references 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 Existing Loan Agreement as amended hereby. The execution of this Amendment
by the Lender shall not operate as a waiver of any of its rights, powers or
privileges under the Loan Agreement or under any of the other Loan Documents,
except as expressly set forth herein.

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 by facsimile transmission shall be effective as delivery of a manually
executed counterpart thereof.

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

[signatures
follow]

2

---

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                                                 
| |  | ----------------------------------------------------------
| |  |                                                           
| |  | **AAMES CAPITAL
      CORPORATION**                       
| |  |                                                           
| |  | By _____________________________________________          
| |  |                                                           
| |  | Name: Jon D. Van Deuren
      Title: Senior Vice President
| |  |                                                           
| |  | **AAMES FUNDING
      CORPORATION**                       
| |  |                                                           
| |  |                                                           
| |  | By _____________________________________________          
| |  |                                                           
| |  | Name: Jon D. Van Deuren
      Title: Senior Vice President
| |  |                                                           
| |  |                                                           
| |  | LENDER                                                    
| |  |                                                           
| |  | **MORGAN STANLEY
        MORTGAGE CAPITAL INC.**          
| |  |                                                           
| |  | By _____________________________________________          
| |  |                                                           
| |  | Name:
      Title: