EXHIBIT 10.4 First Amendment to Security and Loan Agreement (Accounts Receivable) This First Amendment ("Amendment") amends that certain Security and Loan Agreement (Accounts Receivable) ("Security and Loan Agreement") with the attached Addendum ("Addendum") both dated February 9 , 1998 (such Security and Loan Agreement and Addendum herein referred to as "Agreement") by and between Imperial Bank ("Bank") The Keith Companies, Inc. and Keith Engineering, Inc. ("Co-Borrowers") as follows-. 1. The first paragraph of the Security and Loan Agreement is hereby amended to read in full as follows: "This Agreement is entered into between The Keith Companies ("Companies"), Keith Engineering ("Engineering"), ESI, Engineering Services, Inc. ("ESI") ("Companies, Engineering and ESI each a co-borrower hereunder and jointly and severally herein called "Borrower") and IMPERIAL BANK (herein called "Bank")" 2. ESI is hereby added as a Borrower to the Agreement, and wherever the term "Borrower" "Borrowers", "Co-Borrower" or "Co-Borrowers" is used in the Agreement it shall mean each Borrower jointly and severally. 3. Paragraph 1. of the Agreement is amended by deleting the term "75.000% of Eligible Accounts" therefrom and substituting the following therefore: "75.000% of the Eligible Accounts of Companies and Engineering, and 80.000% of the Eligible Accounts of ESI" 4. Paragraph 1. of the Addendum is hereby amended in full to read as follows: "1. a. Any commitment of Bank, pursuant to the terms of the Security and Loan Agreement, to make advances against Eligible Accounts shall expire on FEBRUARY 8, 1999, subject to Bank's right to renew said commitment at its sole discretion. Any renewal of the commitment shall not be binding upon the Bank unless it is in writing and signed by an officer of the Bank. b. The extensions of credit under the Security and Loan Agreement shall be available as follows: (i). Up to $5,000,000 in direct advances. (ii). Up to $ 150,000 for the issuance of a standby letter of credit with a termination date of no later than January 31, 1999. (iii) The aggregate amount of all (a) direct advances to ESI and (b) all letters of credit issued by the Bank for the Account of ESI cannot exceed $750,000 at any one time. (iv). The combined outstandings of (i) and (ii) shall not exceed $5,000,000. 5. The following is added as sub-paragraph m to Paragraph 6 of the Addendum: "m Any account receivable of any Borrower shall be ineligible until such time that Bank has perfected a first priority security interest in any such account." 6. The following is added as Paragraph l4 of the Addendum:. " 14. a . Each of the Borrowers is accepting joint and several liability hereunder in consideration of the financial accommodations to be provided by the Bank, for, the mutual benefit, directly and indirectly, of each of the Borrowers and in consideration of the undertakings of each of the Borrowers to accept joint and several liability for the obligations of each of them. b. Each of the Borrowers, jointly and severally, hereby irrevocable and unconditionally accept, not merely as a surety but also as a co-debtor, joint and several liability with each of the other Borrowers, with respect to the payment and performance of all of the obligations of each Borrower to Bank hereunder, it being the intention of the parties hereto that all the obligations of any Borrower to Bank be joint and several obligations of all of the Borrowers without preferences or distinction among them. c. If and to the extent that any of the Borrowers shall fail to make any payment with respect of any of the obligations hereunder when due, or to perform any of such obligations in accordance with the terms thereof, then in each such event each of the other Borrowers will make such payment with respect to, or perform such obligation. d. The obligations of each Borrower under the provisions of this Section 14 constitute the absolute and unconditional obligations of such Borrower enforceable against it to the full extent permitted under the terms hereof, irrespective of the validity, regularity or enforceability of this Agreement or any other circumstances whatsoever. e. Each Borrower waives (i) any notice of acceptance of its joint and several liability, or any right to require the Bank to proceed against any other Borrower or any other person, firm or corporation or to proceed against or exhaust any security held by it at any time or to pursue any other remedy in its power, (ii) any defense that may arise by reason of the incapacity, lack of authority, death or disability of, or revocation hereof by any other Borrower or others or the failure of the Bank to file or enforce a claim against the estate (either in administration, bankruptcy or other proceeding) of any other Borrower or any others, (iii) demand, protest and notice of any kind including, without limiting the generality of the foregoing, notice of the existence, creation or incurring of new or additional indebtedness or of any action or non-action on the part of any Borrower, the Bank, any endorser, creditor of any Borrower under this or any other instrument, or any other person whomsoever, in connection with any obligation or evidence of indebtedness of the Borrowers; (iv) any defense based upon an election of remedies by the Bank, including, without limitation, an election to proceed by nonjudicial rather than judicial foreclosure, which election destroys or otherwise impairs subrogation rights of any Borrower or the right of a Borrower to proceed against any other Borrower for reimbursement, or both, and (v) any defense or right based upon the acceptance by the Bank or an affiliate of the Bank of a deed in lieu of foreclosure, without extinguishing the indebtedness, even if such acceptance destroys, alters or otherwise impairs subrogation rights of any Borrower or the right of any Borrower to proceed against any other Borrower for reimbursement, or both." 7. Except as provided above, the Agreement remains unchanged. 8. This Amendment is effective as of March 23, 1998, and the parties hereby confirm that the Agreement as amended is in full force and effect. THE KEITH COMPANIES, INC. By: /s/ ARAM H. KEITH Name: Aram H. Keith Title: Signatures continued on next page. KEITH ENGINEERING, INC By: /s/ ARAM H. KEITH Name: Aram H. Keith Title: ESI, ENGINEERING SERVICES, INC. By: /s/ ARAM H. KEITH Name: Aram H. Keith Title: IMPERIAL BANK By: /s/ DENISE PARDUE Name: Denise Pardue Title: V.P.