EXHIBIT 10.5 FIFTH AMENDMENT THIS FIFTH AMENDMENT (this "Fifth Amendment") dated as of July 6, 1998 is to the Credit Agreement (the "Credit Agreement") dated as of September 15, 1995 between TETRA TECH, INC. (the "Company") and BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION (the "Bank"). Unless otherwise defined herein, terms defined in the Credit Agreement are used herein as defined therein. WHEREAS, the parties hereto have entered into the Credit Agreement which provides for the Bank to make Loans to, and to issue Letters of Credit for the account of, the Company from time to time; and WHEREAS, the parties hereto desire to amend the Credit Agreement as set forth below; NOW, THEREFORE, in consideration of the premises and for other good and valuable consideration (the receipt and sufficiency of which are hereby acknowledged), the parties hereto agree as follows: SECTION 1 AMENDMENTS. Effective on (and subject to the occurrence of) the Fifth Amendment Effective Date (as defined below), the Credit Agreement shall be amended as follows: SECTION 1.1 SECTION 2.1. Section 2.1 of the Credit Agreement is amended by (i) deleting the amount "$55,000,000" therein and substituting the amount "$70,000,000" therefor and (ii) deleting the amount "$10,000,000" therein and substituting the amount "$20,000,000" therefor. SECTION 1.2 SUBSECTION 10.6.1. Subsection 10.6.1 is amended in its entirety to read as follows: 10.6.1. TOTAL DEBT TO EBITDA RATIO. Not permit the Total Debt to EBITDA Ratio to exceed 3.0 to 1 as of the last day of any Fiscal Quarter after the Effective Date. SECTION 1.3 SUBSECTION 10.6.2. Subsection 10.6.2 is amended in its entirety by deleting the text thereof and substituting the phrase "[Intentionally deleted.]" therefor. SECTION 1.4 SUBSECTION 10.6.4. Subsection 10.6.4 is amended in its entirety by deleting the text thereof and substituting the phrase "[Intentionally deleted.]" therefor. SECTION 1.5 EXHIBIT A. Exhibit A to the Credit Agreement is amended in its entirety to read in the form of EXHIBIT A hereto. SECTION 2 CONSENT. The Bank hereby consents to the acquisition (the "Acquisition") by the Company of McNamee, Porter & Seeley, Inc. ("MPS"), a Michigan corporation, pursuant to the Stock Purchase Agreement dated as of June __, 1998 among the Company and MPS. SECTION 3 REPRESENTATIONS AND WARRANTIES. The Company represents and warrants to the Bank that (a) each warranty set forth in Section 9 of the Credit Agreement is true and correct as if made on the date hereof, (b) the execution and delivery by the Company of this Fifth Amendment, the New Note (as defined below) and the letter agreement (the "Pledge Agreement Amendment") dated as of June 19, 1998 amending the Pledge Agreement, the execution and delivery by MPS, McNamee Industrial Services, Inc. ("MIS") and McNamee Leasing, Inc. ("MLI" and, together with MPS and MIS, collectively the "New Subsidiaries" and each individually a "New Subsidiary") of the Security Agreement and the Guaranty, the execution and delivery by the Company and its Subsidiaries (including the New Subsidiaries) of the letter agreement (the "Security Agreement Amendment") dated as of June 19, 1998 amending the Security Agreement, the performance by the Company of its obligations under the Credit Agreement as amended hereby (as so amended, the "Amended Credit Agreement"), the New Note and the Pledge Agreement as amended by the Pledge Agreement Amendment (as so amended, the "Amended Pledge Agreement"), the performance by the New Subsidiaries of their respective obligations under the Guaranty and the performance by the Company and its Subsidiaries (including the New Subsidiaries) of their respective obligations under the Security Agreement as amended by the Security Agreement Amendment (as so amended, the "Amended Security Agreement) (i) are within the corporate powers of the Company and each Subsidiary, (ii) have been duly authorized by all necessary corporate action, (iii) have received all necessary governmental approval and (iv) do not and will not contravene or conflict with any provision of law or of the charter or by-laws of the Company or any Subsidiary or of any indenture, loan agreement or other material contract, order or decree which is binding upon the Company or any Subsidiary, and (c) this Fifth Amendment, the Amended Credit Agreement, the New Note, the Pledge Agreement Amendment, the Amended Pledge Agreement, the Security Agreement Amendment, the Amended Security Agreement and the Guaranty are legal, valid and binding obligations of the Company and each Subsidiary (including the New Subsidiaries) which is a party thereto, as applicable, enforceable against the Company and each such Subsidiary (including the New Subsidiaries) in accordance with their respective terms, except as enforceability may be limited by bankruptcy, insolvency or other similar laws of -2- general application affecting the enforcement of creditor's rights or by general principles of equity limiting the availability of equitable remedies. SECTION 4 EFFECTIVENESS. The amendments set forth in SECTION 1, and the consent set forth in SECTION 2, shall become effective, as of the day and year first above written, on the date (the "Fifth Amendment Effective Date") that the Bank shall have received (i) an amendment fee of $25,000, (ii) counterparts of this Fifth Amendment executed by the Company and the Bank and acknowledged and consented to by each existing Subsidiary and (iii) each of the following documents in form and substance satisfactory to the Bank: (a) RESOLUTIONS OF COMPANY. Certified copies of resolutions of the Board of Directors of the Company authorizing the execution and delivery of this Fifth Amendment and the performance of its obligations under the Amended Credit Agreement. (b) INCUMBENCY AND SIGNATURE CERTIFICATE OF COMPANY. A certificate of the Secretary or the Assistant Secretary of the Company certifying the names and true signatures of the officers of the Company authorized to execute, deliver and perform, as applicable, this Fifth Amendment and all other documents to be executed in connection therewith. (c) RESOLUTIONS OF NEW SUBSIDIARIES. Certified copies of resolutions of the Board of Directors of each New Subsidiary authorizing the execution and delivery of the Security Agreement, the Security Agreement Amendment and the Guaranty and the performance of its obligations under each of the Amended Security Agreement and the Guaranty. (d) INCUMBENCY AND SIGNATURE CERTIFICATES OF NEW SUBSIDIARIES. A certificate of the Secretary or the Assistant Secretary of each New Subsidiary certifying the names and true signatures of its officers authorized to execute and deliver the Guaranty, the Security Agreement, the Security Agreement Amendment and all other documents to be executed by such New Subsidiary in connection therewith. (e) GUARANTY. A counterpart of the Guaranty duly executed by each New Subsidiary. (f) SECURITY AGREEMENT. A counterpart of the Security Agreement duly executed by each New Subsidiary, together with such UCC financing statements as are necessary or as the Bank may request in order to perfect the security interest of the Bank in the collateral granted by such New Subsidiary under the Security Agreement. -3- (g) SECURITY AGREEMENT AMENDMENT. A counterpart of the Security Agreement Amendment duly executed by the Company and its Subsidiaries (including the New Subsidiaries). (h) PLEDGE AGREEMENT AMENDMENT. A counterpart of the Pledge Agreement Amendment duly executed by the Company, together with the share certificates of each New Subsidiary and stock powers executed in blank with respect thereto. (i) NEW NOTE. The promissory note of the Company (the "New Note") in the form of EXHIBIT A hereto. (j) ACQUISITION. Evidence, satisfactory to the Bank, that the Acquisition has occurred or will occur concurrently with the effectiveness of this Fifth Amendment. (k) OPINION. The opinion of Riordan & McKinzie, counsel to the Company and its Subsidiaries (including the New Subsidiaries), in form and substance satisfactory to the Bank. SECTION 5 MISCELLANEOUS. SECTION 5.1 CONTINUING EFFECTIVENESS, ETC. As herein amended, the Credit Agreement shall remain in full force and effect and is hereby ratified and confirmed in all respects. SECTION 5.2 COUNTERPARTS. This Fifth Amendment may be executed in any number of counterparts and by the different parties on separate counterparts, and each such counterpart shall be deemed to be an original but all such counterparts shall together constitute one and the same Fifth Amendment. SECTION 5.3 GOVERNING LAW. This Fifth Amendment shall be a contract made under and governed by the internal laws of the State of Illinois. SECTION 5.4 SUCCESSORS AND ASSIGNS. This Fifth Amendment shall be binding upon the Company and the Bank and their respective successors and assigns, and shall inure to the benefit of the Company and the Bank and the successors and assigns of the Bank. -4- Delivered at Chicago, Illinois, as of the day and year first above written. TETRA TECH, INC. By ------------------------------- Title ------------------------------- BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION By ------------------------------- Title ------------------------------- Each of the undersigned hereby acknowledges and consents to the foregoing Fifth Amendment and the Amended Credit Agreement and hereby confirms the continuing effectiveness of the Guaranty and the Security Agreement with respect to the Amended Credit Agreement. HSI GEOTRANS, INC. By: ------------------------- Title: ------------------------- SIMONS, LI & ASSOCIATES, INC. By: ------------------------- Title: ------------------------- TETRA TECH EM, INC. By: ------------------------- Title: ------------------------- WHALEN & COMPANY, INC. By: ------------------------- Title: ------------------------- TETRA TECH NUS, INC. (formerly known as NUS Acquisition Corp. By: ------------------------- Title: ------------------------- EXHIBIT A FORM OF NOTE $70,000,000 June __, 1998 Chicago, Illinois The undersigned, for value received, promises to pay to the order of BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION, a national banking association having an office at 231 South LaSalle Street, Chicago, Illinois (the "Bank") at the principal office of the Bank in Chicago, Illinois, SEVENTY MILLION DOLLARS or, if less, the aggregate unpaid amount of all Loans made by the undersigned pursuant to the Credit Agreement referred to below (as shown on the schedule attached hereto (and any continuation thereof) or in the records of the Bank), such principal amount to be payable in installments as set forth in the Credit Agreement. The undersigned further promises to pay interest on the unpaid principal amount of each Loan from the date of such Loan until such Loan is paid in full, payable at the rate(s) and at the time(s) set forth in the Credit Agreement. Payments of both principal and interest are to be made in lawful money of the United States of America. This Note evidences indebtedness incurred under, and is subject to the terms and provisions of, the Credit Agreement, dated as of September 15, 1995 (as amended or otherwise modified from time to time, the "Credit Agreement"; terms not otherwise defined herein are used herein as defined in the Credit Agreement), between the undersigned and the Bank, to which Credit Agreement reference is hereby made for a statement of the terms and provisions under which this Note may or must be paid prior to its due date or its due date accelerated. In addition to and not in limitation of the foregoing and the provisions of the Credit Agreement, the undersigned further agrees, subject only to any limitation imposed by applicable law, to pay all expenses, including reasonable attorneys' fees and legal expenses, incurred by the holder of this Note in endeavoring to collect any amounts payable hereunder which are not paid when due, whether by acceleration or otherwise. This Note is made under and governed by the internal laws of the State of Illinois. TETRA TECH, INC. By: ------------------------- Title: ------------------------- Schedule Attached to Note dated June __, 1998 of TETRA TECH, INC. payable to the order of BANK OF AMERICA NATIONAL TRUST AND SAVINGS ASSOCIATION. Date and Date and Amount of Amount of Loan or of Repayment or of Interest Conversion from Conversion into Period/ Unpaid another type of another type of Maturity Principal Notation Loan Loan Date Balance Made by 1. FLOATING RATE LOANS _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ 2. EURODOLLAR LOANS _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________