**Exhibit 10.13**

**Execution Copy**

**AMENDMENT NO. 6 TO THE**

**LOAN AND SECURITY AGREEMENT**

Dated as of October 17, 2008 

**AMENDMENT NO. 6 TO THE LOAN AND SECURITY AGREEMENT** (this “Amendment”) by and between Residential Funding Company, LLC, a Delawarelimited liability company, as borrower (“RFC”), GMAC Mortgage, LLC, a Delaware limited liability company, as borrower (“GMACM” and together with RFC, each a “Borrower” and collectively, the“Borrowers”), Residential Capital, LLC, a Delaware limited liability company, as guarantor (the “Guarantor”) and GMAC LLC, a Delaware limited liability company, as lender (the “Lender”). 

**PRELIMINARY STATEMENTS**: 

(1) TheBorrowers and the Lender have entered into a Loan and Security Agreement dated as of April 18, 2008 (the “Loan and Security Agreement”). Capitalized terms not otherwise defined in this Amendment have the same meanings asspecified in the Loan and Security Agreement. 

(2) The Borrowers and the Lender have entered into an Amendment No. 1 to the Loan andSecurity Agreement dated May 21, 2008. 

(3) The Borrowers and the Lender have entered into an Amendment No. 2 to the Loan andSecurity Agreement dated May 22, 2008. 

(4) The Borrowers and the Lender have entered into an Amendment No. 3 to the Loan andSecurity Agreement dated June 2, 2008. 

(5) The Borrowers and the Lender have entered into an Amendment No. 4 to the Loan andSecurity Agreement dated July 25, 2008. 

(6) The Borrowers and the Lender have entered into an Amendment No. 5 to the Loan andSecurity Agreement dated October 3, 2008. 

(7) The Guarantor executed a guarantee (the “Guarantee”) dated as ofApril 18, 2008 in favor of the Lender in connection with the Loan and Security Agreement. 

(8) The Borrowers have requested the Lenderto amend, and the Lender has agreed to amend, the Loan and Security Agreement on the terms and conditions set forth herein, and the Guarantor has agreed to be a party to this Amendment. 

For good and valuable consideration, the receipt of which is hereby acknowledged, the parties hereto agree as follows: 

SECTION 1. Deferral of Borrowing Base Deficiency. The Lender hereby defers until 3 p.m. (EST) on October 22, 2008 (the “DeferralDate”) the requirement that the Borrowers repay $84,000,0000 of the Borrowing Base Deficiency described in that certain Notice of Borrowing Base Deficiency dated as of October 10, 2008 (the “Notice of Deficiency”)delivered by the Lender to the Borrowers, together with interest thereon. This deferral is limited to the extent described in the preceding sentence and shall in no way constitute a waiver or forbearance of the Lender’s right to demand paymentof such Borrowing Base Deficiency or any other rights and remedies available to the Lender under the Loan Agreement or any other Facility Document, and the Lender hereby expressly reserves the right to demand payment of such amount on or after theDeferral Date. 

 

1 

SECTION 2. Amendments to the Loan and Security Agreement. The Loan and Security Agreement is,effective as of the date hereof and subject to the satisfaction of the conditions precedent set forth in Section 2 hereof, hereby amended as follows: 

(a) Clause (a) of the definition of “Attributed Rate” is hereby amended and restated in full to read as follows: 

“(a) With respect to Eligible Servicing Rights, and for the period of effectiveness for each Borrowing Base Report, a fraction, (i) the numerator of which is equal to (A) $1,200,000,000 less(B) the Commitment Reduction Amount as of the date of such Borrowing Base Report, and (ii) the denominator of which is the Borrower’s book value of Eligible Servicing Rights as set forth in the September 2008 Borrowing Base Report(which, for the avoidance of doubt, is $1,214,132,395.00); provided however that the Attributed Rate for any Eligible Servicing Rights pledged in accordance with Section 7.01(h) shall be determined by the Lender in its sole and absolutediscretion.” 

(b) The definition of “Commitment Amount” is hereby amended and restated in full to read as follows:

“Commitment Amount” means at any time the excess of (x) $1,200,000,000, over (y) the Commitment ReductionAmount. The Borrowers may elect to further reduce the Commitment Amount in accordance with Section 2.10.” 

(c) The newdefinition set forth below is added to Section 1.01 in the correct alphabetical order: 

“Commitment ReductionAmount” means, at any time, an amount equal to the sum of (x) $84,000,000, plus (y) after October 22, 2008, $84,000,000, plus (z) the amount of any capital contribution made by the Lender to ResCap in the form offorgiveness of the principal amount of Loans outstanding under this Agreement on or after October 1, 2008.” 

(d) The definition of“Loan Repayment Date” is hereby amended and restated in full to read as follows: 

“Loan Repayment Date” means theearlier of (i) May 1, 2009, or if such day is not a Business Day, the immediately preceding Business Day, (ii) upon the Borrowers’ receipt of a commitment from a third-party lender for a replacement facility to be secured by theCollateral, the day specified by either the Borrowers or the Lender upon at least 20 Business Days’ written notice, or (iii) such earlier date as may be notified by Lender in accordance with Section 8.02(a); provided howeverthat the Loan Repayment Date may be extended or accelerated by the mutual agreement of the Lender and Borrowers. 

 

2 

(e) The definition of “Adverse Servicing Event” is hereby amended and restated in full to readas follows: 

“‘Adverse Servicing Event’ means (1) the failure of either Borrower to be an approved servicer underany Servicing Contract with respect to which any Eligible Servicing Rights pledged under this Agreement relate, (2) either Borrower fails to service in accordance with any Servicing Contract in any material respect, (3) either Borrower isterminated as servicer with respect to any Eligible Servicing Rights (except if the provisions of Section 7.01(m)(iii)(a)-(b) are met), or (4) receipt by either Borrower of a notice from any MBS Trustee indicating materialbreach, default or material non-compliance by such Borrower which the Lender reasonably determines may entitle such MBS Trustee to terminate such Borrower, which notice has not been rescinded or nullified within five (5) Business Days of itsreceipt by such Borrower or such lesser time as Lender believes is necessary to protect its interest and provides such Borrower with written notice thereof, as the case may be.” 

(f) Section 4.04(a) is hereby amended by replacing the period at the end of subsection (iii) with “; and” and inserting subsection(iv) after subsection (iii), which subsection (iv) shall read as follows: 

“(iv) if and to the extent not prohibited by alegally enforceable provision of the relevant Servicing Contract, negotiate and arrange for the transfer of any servicing rights under any Servicing Contract to another asset manager, servicer, special servicer or sub-servicer and for the payment ofany sums in respect thereto to the Lender (for application to the Obligations).” 

(g) Section 4.05 is hereby amended and restatedin full to read as follows: 

“The Lender shall have the right, in its sole discretion, to solicit, negotiate with and contract with aparty or parties of the Lender’s choosing to serve as a backup servicer to either or both of the Borrowers and with respect to all or such portion of the Servicing Contracts as the Lender may choose. Each Borrower covenants and agrees that itwill fully cooperate and use its best efforts to assist the Lender in exercising this right in all respects, 

 

3 

including the provision of such information to any such backup servicer as may be required in connection with the negotiation of a backup servicing agreementor for the performance of its duties as backup servicer, the execution of a backup servicing agreement and obtaining from the relevant MBS Trustee, Investors and, if applicable, any bond insurers, a consent to such backup servicingarrangements.” 

(h) Subsection 6.02(e) is hereby amended and restated to read as follows: 

“(e) The Lender has a duly perfected first priority security interest in all Servicing Rights that are included in the Borrowing Base or (to theextent they remain outstanding) have at any time been included in the Borrowing Base.” 

(i) Section 6.01(r) is hereby amended andrestated in full to read as follows: 

“(r) Investor Set Off Rights. Neither Borrower has any actual notice, including any noticereceived from any Investor, or any reason to believe, that, other than in the normal course of such Borrower’s business, any circumstances exist that would result in such Borrower being liable to any Investor for any amount due by reason of:(i) any breach of servicing obligations or breach of mortgage selling warranty to any Investor under the related Servicing Contract or any other similar contracts relating to such Borrower’s entire servicing portfolio with such Investor(including without limitation any unmet mortgage repurchase obligation), (ii) any unperformed obligation with respect to mortgages in an MBS pool that such Borrower is servicing for any Investor under the regular servicing option or othermortgages subject to recourse agreements, (iii) any loss or damage to any Investor by reason of any inability to transfer to a purchaser of the Servicing Rights such Borrower’s selling and servicing representations, warranties andobligations, as well as any existing MBS recourse (regular servicing option) obligations, or other recourse obligations, and (iv) any other unmet obligations to any Investor under the related Servicing Contract or any other similar contractsrelating to the Borrower’s entire servicing portfolio with such Investor.” 

(j) Section 7.01(h) is hereby amended andrestated in full to read as follows: 

“The Borrowers covenant and agree to use their best efforts to pledge, no later thanNovember 30, 2008, additional collateral reasonably acceptable to the Lender to secure the Loans with a market value, as determined by the Lender, in an amount equal or greater to $250,000,000, it being understood that the Lender shall set theAttributed Rate for any such additional collateral in its sole and absolute discretion.” 

(k) Section 7.01(m)(iii) is herebyamended and restated in full to read as follows: 

“It shall diligently fulfill its duties and obligations under the Servicing Contractsand shall not be declared by any Investor to be in default; provided that it shall not be a breach of this covenant if: (a) any Investor shall terminate its rights under any Servicing Contract, or (b) any Servicing Contract expiresat the end of its scheduled term if, in either case, the Borrowers repay (without duplication of payment) to the Lender an amount equal to the excess of the Outstanding Aggregate Loan Amount over the Borrowing Base within (i) three(3) Business Days after such termination if such excess is greater than $50,000,000, or (ii) within one Business Day of such termination otherwise. 

 

4 

(l) The following is hereby inserted after Section 7.01(m)(iii) as Section 7.01(m)(iv):

“(iv) If (1) an Event of Default has occurred which has not been declared in writing by the Lender to have been cured or waivedand (2) the Lender so requests, the Borrower shall promptly (x) resign (in accordance with the terms, conditions and process, if any, set forth in the applicable Servicing Contract) in favor of the Lender’s designee and (y) takeall such other actions as the Lender may reasonably request to cause or permit such designee to acquire such Servicing Rights, except to the extent, if any, that the action requested would be or result in a material violation of the terms andconditions of such Servicing Contract.” 

(m) The following is hereby inserted after Section 8.02(c) as Section 8.02(d):

“(d) Assumption of Servicing Duties. If any Event of Default has occurred and is continuing, in addition to all other rightsand remedies under this Agreement or otherwise, the Lender may, subject to any restrictions imposed by the relevant Servicing Contract (to the extent such restrictions are valid and enforceable under the applicable Uniform Commercial Code and otherrelevant Law), including any such requirements with respect to assignment of the related Borrower’s servicing duties or rights thereunder, act, or contract with one or more third Persons to act, as successor asset manager, servicer, specialservicer or sub-servicer of each item of Collateral requiring asset management or servicing and perform all obligations required in connection with such Servicing Contracts. The Borrowers shall use their best efforts to effect any such assignmentrequested by the Lender, including without limitation soliciting consent to such assignment and providing such records, data, access to systems and other assistance as may be necessary or advisable, in the judgment of the Lender, to facilitate theassumption of servicing obligations by any such Person designated by the Lender.” 

(n) Section 8.03(a) is hereby amended andrestated in full to read as follows: 

“(a) Collection Accounts. On or before the Closing Date, the Borrowers and the Lendershall establish at LaSalle Bank National Association (the “Collection Account Bank”) in the name of the Lender a non-interest bearing segregated special purpose trust account (such account being herein called the “CollectionAccounts” and being identified as: (i) for RFC: Account No. 725378.1 with Account Name “LaSalle Trust –RFC/GMAC Servicing Rights Collection Acct,” and (ii) for GMAC Mortgage: Account No. 725377.1 withAccount Name “LaSalle Trust –GMACM/GMAC Servicing Rights Collection Acct”). The Borrowers hereby agree immediately upon the request of the Lender to deposit all Collections received by or on behalf of the Borrowers into the applicableCollection Account within two (2) Business Days of receipt thereof. The Borrowers and the Lender hereby agree that only the Lender may make withdrawals from the Collection Accounts; provided that until the Lender shall have, following theoccurrence of a Default, given notice to the contrary to the Collection Account Bank, the Lender authorizes the Borrowers to withdraw funds from the Collection Accounts. Upon notice from the Lender that an Event of Default has occurred and iscontinuing, all Collections in respect of the Collateral shall be deposited directly into the Collection Accounts within one (1) Business Day of receipt thereof, and any funds received by either Borrower in respect of any Collections in respectof the Collateral which for any reason have not yet been deposited into the Collection Accounts shall be deemed to be held by such Borrower as the case may be, in trust for the Lender and shall not be used by either Borrower for any purposeswhatsoever.” 

 

5 

SECTION 3. Conditions of Effectiveness. This Amendment shall become effective as of the date firstabove written when, and only when, the Lender shall have received: 

(a) A copy of this Amendment, duly executed by the parties hereto; and

(b) A certificate signed by a Responsible Officer of each Borrower and the Guarantor stating that: 

 
 (i)The representations and warranties contained Section 3 hereof and in the Guarantee (in the case of the Guarantor) or Section 6.01 of the Loan and SecurityAgreement (as amended hereby) (in the case of the Borrowers) are correct on and as of the date of such certificate as though made on and as of such date; and 
 
 (ii)No event has occurred and is continuing that constitutes a Default; 
(c) A copy of the Consent Agreement, dated as of the date hereof, among the Borrowers, certain affiliates of the Borrowers and the Lender, duly executed by the parties thereto. 

 

6 

(d) The Borrowers shall have paid the principal amount of $84,000,000, and accrued and unpaid interestthereon, to remedy the Borrowing Base Deficiency shown in the September, 2008 Borrowing Base Report no later than 6 p.m. (EST) on October 17, 2008; and no other Borrowing Base Deficiency (other than that which was deferred to October 22,2008 as described above) shall exist. 

(e) A copy of the Amended and Restated Note, dated as of October 17, 2008, duly executed by bothof the Borrowers. 

SECTION 4. Representations and Warranties of the Borrowers and the Guarantor. The Borrowers and the Guarantoreach represents and warrants as follows: 

(a) It is a limited liability company duly organized or formed, validly existing and in goodstanding under the laws of Delaware. 

(b) The execution, delivery and performance by it of this Amendment and (as applicable) the Loan andSecurity Agreement, as amended hereby, or the Guarantee and the consummation of the transactions contemplated hereby and thereby will not conflict with, result in any breach of any of the terms and provisions of, or constitute (with or withoutnotice, lapse of time or both) a default under its organizational documents, or any material indenture, loan agreement, mortgage, deed of trust, or other material agreement or interest to which it is a party or by which it is otherwise bound, orresult in the creation or imposition of any Lien upon any of its properties pursuant to the terms of any such indenture, loan agreement, mortgage, deed of trust, or other agreement or instrument, other than this Agreement, or violate anyRequirements of Law applicable to it of any Governmental Authority having jurisdiction over it or any of its properties if such violation, individually, or in the aggregate, is reasonably likely to have a Material Adverse Effect. 

(c) No approval, consent, exemption, authorization, or other action by, or notice to, or filing with, any Governmental Authority or any other Person isnecessary or required in connection with execution, delivery or performance by it of this Amendment and (as applicable) the Loan and Security Agreement, as amended hereby, and the Guarantee. 

(d) This Amendment has been duly executed and delivered by it. This Amendment and (as applicable) the Loan and Security Agreement, as amended hereby, andthe Guarantee constitute, its legal, valid and binding obligations enforceable against it in accordance with its respective terms, except as enforceability may be limited by bankruptcy, insolvency, reorganization, or other similar laws affecting theenforcement of creditors’ rights generally and by general principles of equity, regardless of whether such enforceability is considered in a proceeding in equity or at law. 

(e) There are no proceedings or investigations pending, or to the best of its knowledge threatened in writing, against it before any court, regulatorybody, 

 

7 

administrative agency, or other tribunal or governmental instrumentality (i) asserting the invalidity of any Facility Document, (ii) seeking toprevent the consummation of any of the transactions contemplated by any Facility Document, or (iii) seeking any determination or ruling that could reasonably be expected to have a Material Adverse Effect. 

SECTION 5. Reference to and Effect on the Loan Documents. (a) On and after the effectiveness of this Amendment, each reference in the Loanand Security Agreement to “this Agreement,” “hereunder,” “hereof” or words of like import referring to the Loan and Security Agreement, and each reference in the Note, the Guarantee and the other Facility Documents to“the Loan and Security Agreement,” “thereunder,” “thereof” or words of like import referring to the Loan and Security Agreement, shall mean and be a reference to the Loan and Security Agreement, as amended by thisAmendment and all prior amendments referenced in this Amendment. 

(b) The Loan and Security Agreement, the Guarantee, the Note and the otherFacility Documents, as specifically amended by this Amendment, are and shall continue to be in full force and effect and are hereby in all respects ratified and confirmed. 

(c) The execution, delivery and effectiveness of this Amendment shall not, except as expressly provided herein, operate as a waiver of any right, power or remedy of the Lender under any of Facility Documents, norconstitute a waiver of any provision of any of the Facility Documents. 

SECTION 6. Notice. Each party hereto hereby acknowledgestimely notice of the execution of this Amendment and of the transactions and amendments contemplated hereby. Each party hereto hereby waives any notice requirement contained in the Loan and Security Agreement, the Guarantee or the other FacilityDocuments with respect to the execution of this Amendment. 

SECTION 7. Reservation of Rights. The Borrowers and the Guarantor eachhereby acknowledge and agree that neither this Amendment nor the making of any Loan by the Lender and the Lender’s consent thereto either before or after the date hereof shall constitute (w) an approval of the accuracy of all or anyportion of any Borrower Funding Request, (x) a waiver or forbearance by the Lender or any of the Facility Documents, except as expressly set forth herein, (y) the acceptance by the Lender of any course of conduct by either Borrower, theGuarantor or any other Person or (z) an agreement by the Lender to amend any of the Facility Documents without all required approvals. The Borrowers each hereby further acknowledge and agree that the Lender reserves all rights, remedies andoptions under the Facility Documents to require either Borrower to satisfy in all respects the conditions relating to the making of any Loan under the Loan and Security Agreement and each Borrower and the Guarantor to perform all of its obligationsunder the Facility Documents which are then due and owing or are susceptible of performance, as the case may be. 

SECTION 8.Confirmation of the Facility Documents. The Borrowers and the Guarantor each hereby acknowledge and agree that the Loan and Security Agreement (as herein 

 

8 

amended) the Guarantee and each other Facility Document are each ratified and confirmed in all respects and shall remain in full force and effect inaccordance with their respective terms. Without limiting the foregoing, each Borrower ratifies and reaffirms its grant of a security interest in all the Collateral pledged by it, and agrees that such security interest is a first priority perfectedsecurity interest securing all Obligations and the Borrowers and the Guarantor each ratifies and reaffirms all of its other obligations under the Facility Documents executed and delivered by it. As of the date hereof, each reference in the Loan andSecurity Agreement to “this Agreement” shall mean the Loan and Security Agreement as amended by this Amendment, and as hereinafter amended or restated. 

SECTION 9. Execution in Counterparts. This Amendment may be executed in any number of counterparts and by different parties hereto in separate counterparts, each of which when so executed shall be deemed to bean original and all of which taken together shall constitute but one and the same agreement. Delivery of an executed counterpart of a signature page to this Amendment by telecopier shall be effective as delivery of a manually executed counterpart ofthis Amendment. 

SECTION 10. **GOVERNING LAW; SUBMISSION TO JURISDICTION. THIS AGREEMENT SHALL BE GOVERNED BY AND CONSTRUED INACCORDANCE WITH THE LAWS OF THE STATE OF NEW YORK WITHOUT REGARD TO CONFLICTS OF LAWS PRINCIPLES (BUT WITH REFERENCE TO SECTION 5-1401 OF THE NEW YORK OBLIGATION LAW, WHICH BY ITS TERMS APPLIES TO THIS AGREEMENT).**

 

9 

IN WITNESS WHEREOF, the parties hereto have caused this Amendment to be executed by their respectiveofficers thereunto duly authorized, as of the date first above written. 

 
**GMAC LLC**a Delaware limited liability companyBy: 
/s/ David Walker
Name: David WalkerTitle: Group VP and Treasurer
**RESIDENTIAL CAPITAL, LLC**

a Delawarelimited liability company as Guarantor
By 
/s/ Melissa White
Name: Melissa WhiteTitle: Assistant Treasurer
**RESIDENTIAL FUNDING COMPANY, LLC**

aDelaware limited liability company
By 
/s/ Melissa White
Name: Melissa WhiteTitle: Assistant Treasurer
**GMAC MORTGAGE, LLC**

a Delaware limitedliability company
By 
/s/ Melissa White
Name: Melissa WhiteTitle: Assistant Treasurer
 

S-1