Exhibit 10.22

EXECUTION COPY

AMENDMENT

dated as of June 1, 2009

between

GMAC Investment Management LLC and

Residential Funding Company, LLC

to the

ISDA MASTER AGREEMENT

dated as of March 18, 2009

between

GMAC Investment Management LLC and

Residential Funding Company, LLC

(the Agreement)

GMAC Investment Management LLC (GMAC IM)and Residential Funding Company, LLC
(RFC) have previously entered into the Agreement and now agree to amend the Agreement by the terms of this Amendment (this Amendment).

Accordingly, in consideration of the mutual agreements contained in this Amendment, the parties agree as follows:



|1. | Amendment of the Agreement
|-- | --------------------------



| | (a) | Part 4(f) of the Schedule to the Agreement is amended and restated in its entirety to read as follows:
| | --- | ------------------------------------------------------------------------------------------------------



| | (f) | Credit Support Documents.
| | ---- | -------------------------

Credit Support Document
for Party A means (i) the Guaranty of the Credit Support Provider of Party A, and (ii) Credit Support Annex annexed hereto which supplements, forms part of, and is subject to, this Agreement.

Credit Support Document for Party B means (i) the Guarantee and Master Netting Agreement, dated as of March 18, 2009, by and among Party A,
GMACM, RFC, ResCap, RFC Asset Holdings II, LLC (RAHI), Passive Asset Transactions, LLC (PATI) and GMAC LLC (as amended or modified from time to time, the Guarantee and



---

Master Netting Agreement); (ii) Credit Support Annex annexed hereto which supplements, forms part of, and is subject to, this Agreement,
(iii) the Omnibus Pledge and Security Agreement and Irrevocable Proxy, dated as of March 18, 2009, among RAHI, PATI and certain of their Affiliates from time to time parties thereto, as grantors, Party A, as a secured party, and GMAC LLC,
as Omnibus Agent, as Lender Agent under the November Loan Agreement, as a secured party and as lender under the MSR Loan Agreement (as defined below) (as amended or modified from time to time, the Omnibus Security Agreement),
(iv) the Pledge and Security Agreement and Irrevocable Proxy, dated as of November 20, 2008, between RAHI, PATI and certain of their Affiliates from time to time party thereto, as grantors, and GMAC LLC, as lender agent (as amended or
modified from time to time, the November Security Agreement), (v) the Loan and Security Agreement, dated as of April 18, 2008, among RFC and GMACM, as borrowers, and GMAC LLC, as lender (as amended or modified from time
to time, the MSR Loan Agreement), and (vi) the Pledge and Security Agreement and Irrevocable Proxy, dated as of June 1, 2009, between RAHI, PATI and certain of their Affiliates from time to time party thereto, as
grantors, and GMAC LLC, as secured party (as amended or modified from time to time, the Fourth Security Agreement).



| | (b) | Part 5(j) of the Schedule to the Agreement is amended and restated in its entirety to read as follows:
| | --- | ------------------------------------------------------------------------------------------------------

Restriction on Liens. Party B hereby agrees that it shall not grant any lien or security interest in its rights under this Agreement other
than (i) the lien created pursuant to the Omnibus Security Agreement, (ii) the lien created pursuant to the Fourth Security Agreement and (iii) any lien for taxes or assessments or other governmental charges or levies not then due and
payable (or which, if due and payable, are being contested in good faith either with the third party to whom such taxes are owed or the third party obligated to pay such taxes and for which adequate reserves are being maintained, to the extent
required by generally accepted accounting principles, and such proceedings have the effect of preventing the forfeiture or sale of the property or assets subject to any such lien).



|2. | Representations
|-- | ---------------

RFC represents to GMAC IM in
respect of the Agreement, as amended pursuant to this Amendment, that all representations made by RFC pursuant to the Agreement are true and accurate as of the date of this Amendment.



2



---

|3. | Consent to Security Interest
|-- | ----------------------------

Each of the parties
hereto hereby consent to the creation and existence of the security interests in the Collateral created by the Fourth Security Agreement.



|4. | Miscellaneous
|-- | -------------



| | (a) | Entire Agreement; Restatement.
| | --- | ------------------------------



| | (i) | This Amendment constitutes the entire agreement and understanding of the parties with respect to its subject matter and supersedes all oral communication and prior writings (except
as otherwise provided herein) with respect thereto.
| | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



| | (ii) | Except for any amendment to the Agreement made pursuant to this Amendment, all terms and conditions of the Agreement will continue in full force and effect in accordance with its
provisions on the date of this Amendment. References to the Agreement will be to the Agreement, as amended by this Amendment.
| | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



| | (b) | Amendments.No amendment, modification or waiver in respect of the matters contemplated by this Amendment will be effective unless made in accordance with the
terms of the Agreement.
| | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



| | (c) | Counterparts. This Amendment may be executed and delivered in counterparts (including by facsimile transmission), each of which will be deemed an original.
| | --- | -----------------------------------------------------------------------------------------------------------------------------------------------------------



| | (d) | Headings. The headings used in this Amendment are for convenience of reference only and are not to affect the construction of or to be taken into consideration in
interpreting this Amendment.
| | --- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



| | (e) | Governing Law.This Amendment will be governed by and construed in accordance with the laws of the State of New York (without reference to choice of law
doctrine).
| | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------

[signature pages follow]



3



---

IN WITNESS WHEREOF the parties have executed this Amendment on the respective dates specified below with
effect from the date specified first on the first page of this Amendment.



|                               |  |                    
|------------------------------ |  | -------------------
|GMAC INVESTMENT MANAGEMENT LLC
|                               | 
|By:                            |  | /s/ Melissa Melvin 
|Name:                          |  | Melissa Melvin     
|Title:                         |  | Assistant Secretary
|Date:                          |  | June 1, 2009       



|                                 |  |                     
|-------------------------------- |  | --------------------
|RESIDENTIAL FUNDING COMPANY, LLC
|                                 | 
|By:                              |  | /s/ John M. Peterson
|Name:                            |  | John M. Peterson    
|Title:                           |  | Treasurer           
|Date:                            |  | June 1, 2009        









| |  |     |  |                                       
| |  | --- |  | --------------------------------------
| |  | S-1 |  | Amendment to GMAC IM-RFC ISDA Schedule