1
                                                                   Exhibit 10.40
                                                                   -------------



                           AMENDMENT NO. 2 and WAIVER
                           Dated as of August 12, 1997
                                       to
                           REVOLVING CREDIT AGREEMENT
                            Dated as of May 31, 1995


                  THIS AMENDMENT NO. 2 and WAIVER dated as of August 12, 1997
(this "Amendment") is entered into by and among OHM Corporation ("OHM"), OHM
Remediation Services Corp. ("Remediation", and together with OHM, the
"Borrowers"), the financial institutions listed on the signature pages hereto
(collectively, the "Banks"), Citicorp USA, Inc., as administrative agent (in
such capacity, the "Administrative Agent") and Bank of America National Trust
and Savings Association (successor by merger to Bank of America Illinois), as
issuing and paying agent and as co-agent (in such capacity, the "Issuing and
Paying Agent").


                              PRELIMINARY STATEMENT
                              ---------------------

                  A. The Borrowers, the Banks, the Administrative Agent and the
Issuing and Paying Agent have entered into that certain Revolving Credit
Agreement dated as of May 31, 1995 (as amended, the "Credit Agreement";
capitalized terms used and not otherwise defined herein shall have the meanings
ascribed to them in the Credit Agreement as amended by this Amendment No. 2),
pursuant to which, among other things, the Banks have agreed to make certain
loans, issue certain letters of credit and make certain other financial
accommodations to the Borrowers upon the terms and conditions set forth therein.

                  B. Subject to the terms and conditions set forth below, the
Borrowers, the Banks, the Administrative Agent and the Issuing and Paying Agent
have, among other things, agreed to amend the Credit Agreement as hereinafter
set forth.

                  NOW, THEREFORE, in consideration of the premises set forth
herein, and for other good and valuable consideration, the receipt and
sufficiency of which are hereby acknowledged, the parties hereto agree as
follows:

                  SECTION 1. AMENDMENT TO THE CREDIT AGREEMENT. Subject to the
satisfaction of the conditions precedent set forth in SECTION 2 below, the
Credit Agreement shall be amended as follows:

                  1.01. The following definitions are added to SECTION 1.01 of
the Credit Agreement, to be inserted therein in alphabetical order:

                  "BENECO" means Beneco Enterprises Inc., a Utah corporation.



   2



                  "BENECO ACQUISITION" means the acquisition by OHM of all of
         the capital stock of Beneco on or about June 18, 1997 for an aggregate
         consideration of $15,000,000.

                  "JUNE 1997 CHARGE" means the charges taken by the Borrowers in
         the fiscal quarter ending June 30, 1997 in the aggregate amount of
         $37,877,000, in connection with (a) the settlement of certain
         litigation between the Borrowers and Citgo Petroleum Company, discussed
         in OHM's Form 10-K for its fiscal year ended December 31, 1996 filed
         with the Securities Exchange Commission (the "1997 10-K"), (b) the
         write-down of certain receivables, including the receivables from
         Separation and Recovery Systems, Inc. and Occidental Chemical
         Corporation, also discussed in the 1997 10-K, (c) the write-down of
         certain laboratory facilities and consolidation of regional offices,
         and (d) to the extent included in selling, general and administrative
         expense, the charge in the amount of $14,949,000 taken with respect to
         OHM's investment in the NSC Companies.

                  "PERMITTED ACQUISITIONS" means the acquisition by either
         Borrower of all of the capital stock or other equity interests of any
         Person, or the acquisition of assets on an ongoing concern basis from
         any Person, provided that:

                           (a) both immediately prior and after giving effect to
                  such acquisition, no Default or Event of Default is or would
                  be outstanding;

                           (b) after giving effect to such acquisition, the
                  Borrowers would satisfy the covenants set forth in SECTIONS
                  5.02(e) and 5.02(m) through 5.02(o), determined as of the end
                  of the most recently ended quarter on a pro forma basis after
                  giving effect to such acquisition; and with respect to any
                  acquisition or series of related acquisitions for which the
                  aggregate consideration to be paid will be greater than
                  $5,000,000, audited financial statements (or unaudited
                  financial statements reasonably acceptable to the
                  Administrative Agent) for the most recently ended fiscal year
                  with respect to the acquired Person or assets shall be
                  available so that determination of such pro forma compliance
                  can be made on the basis of such audited financial statements,
                  and subsequent unaudited quarterly financial statements, if
                  applicable;

                           (c) as of the date of such acquisition, (i) such
                  acquired Person or assets are in compliance in all material
                  respects with all Environmental Laws and health and safety
                  statutes and regulations, (ii) there are no material
                  governmental investigations of the environmental matters of
                  such Person or assets, (iii) there are no contingent
                  liabilities or pending or threatened litigation with respect
                  to such Person or assets which could reasonably be expected to
                  have a material adverse effect on the financial condition or
                  operations of the Borrowers taken as a whole, and (iv) the
                  proposed acquisition shall not subject the Administrative
                  Agent, the Issuing and Paying Agent, the Banks, any Issuing
                  Bank or any of their respective Affiliates or properties to
                  any Environmental Law (including without limitation, any
                  clean-up responsibility law or restrictive transfer law or
                  regulation);


                                       -2-

   3



                           (d) after giving effect to the acquisition of such
                  Person or assets, such Person or assets would constitute
                  either a division or a wholly owned Subsidiary of a Borrower
                  or of a wholly owned Subsidiary of a Borrower;

                           (e) such acquisition is consensual and shall have
                  been approved by the board of directors, shareholders, members
                  or partners, as applicable, of the Person whose stock or
                  assets are being acquired prior to the consummation of such
                  acquisition;

                           (f) the Borrowers shall have delivered to the
                  Administrative Agent and the Issuing and Paying Agent an
                  officer's certificate certifying that the conditions set forth
                  in clauses (1) through (5) above are satisfied with respect to
                  such acquisition, and that such acquisition is being made for
                  consideration which in the opinion of management of the
                  Borrowers is not in excess of fair value for the business,
                  property and/or assets acquired in such acquisition.

                  "PERMITTED OTHER INDEBTEDNESS" means purchase money
         Indebtedness (or refinancings thereof secured by the same assets) and
         Long Term Lease Obligations of a Borrower or a Subsidiary, other than
         Indebtedness described in SECTIONS 5.02(j)(iv) or (vii), which at the
         time of incurrence of any such purchase money Indebtedness (or the
         refinancings thereof) or Long Term Lease Obligations (and after giving
         effect to such incurrence), would not in the aggregate exceed (a)
         $30,000,000 during any Facility B Level 5 Period, Facility B Level 4
         Period or Facility B Level 3 Period, (b) twenty-five percent (25%) of
         Net Worth during any Facility B Level 2 Period, or (c) thirty percent
         (30%) of Net Worth during any Facility B Level 1 Period. "Permitted
         Other Indebtedness" includes any such purchase money Indebtedness or
         Long Term Lease Obligations of a Subsidiary acquired as part of a
         Permitted Acquisition, or any such purchase money Indebtedness or Long
         Term Lease Obligations assumed by a Borrower or a wholly owned
         Subsidiary of a Borrower in a Permitted Acquisition, and the date of
         the initial incurrence of such purchase money Indebtedness or Long Term
         Lease Obligation for the purposes of this Agreement shall be the date
         of such Permitted Acquisition.

                  1.02. The definition of "EBITDA" is amended by adding the
following immediately preceding the period at the end of that definition:

                  "PLUS, in the case of any period which includes the fiscal
                  quarter ending June 30, 1997, the amount of the June 1997
                  Charge."

                  1.03. The definition of "Indebtedness" is amended by striking
"or" before clause (c) thereof, and inserting the following after the end of
clause (c);

                  "or (d) obligations to make earn out payments with respect to
                  the Beneco Acquisition or any Permitted Acquisition"


                                       -3-

   4



                  1.04. SECTION 2.03 is amended by deleting the reference
therein to "11:00 A.M." (with respect to the time for requesting a Borrowing)
and substituting "1:00 P.M." therefor, and by deleting the existing reference
therein to "1:00 P.M." (with respect to the time for each Bank's making
available its Contractual Percentage of a Requested Borrowing) and substituting
"3:00 P.M." therefor.

                  1.05. SECTION 2.11 is amended by deleting the reference
therein to "11:00 A.M." (with respect to the time for making payments under the
Credit Agreement) and substituting "1:00 P.M." therefor.

                  1.06. SECTION 5.02(a)(xiii) is deleted and replaced by the
phrase "This Section Intentionally Left Blank".

                  1.07. SECTION 5.02(b) is amended by deleting clause (ii) (but
not the proviso in SECTION 5.02(b)), and substituting the following therefor:

                  "(ii) as part of a Permitted Acquisition, any Person may merge
                  with or into or so transfer its assets to OHM or a wholly
                  owned Subsidiary thereof;"

                  1.08. SECTION 5.02(c)(v) is amended and restated as follows:

                  "(v) the sale by OHM of shares of the common stock of NSC
                  Corporation currently owned by OHM; PROVIDED, HOWEVER, that
                  prior to the date of any such proposed sale, an Authorized
                  Officer of OHM shall have delivered a certificate to the
                  Administrative Agent and the Issuing and Paying Agent
                  certifying that the sale price was at or above the fair value
                  of the stock being sold in the reasonable determination of
                  OHM's management and that the board of directors of OHM has
                  approved such sale;"

                  1.09. SECTION 5.02(e) is amended and restated as follows:

                  "(e) Materially change the nature of its business from
                  providing (i) environmental remediation services, including
                  comprehensive on-site treatment of toxic materials and
                  hazardous wastes for the government and private sector, as
                  well as site assessment, engineering, remedial design and
                  analytical testing for such remediation services and projects
                  and (ii) operations, management, testing, training,
                  maintenance, engineering, construction and related outsourcing
                  services for the government and private sector."

                  1.10. SECTION 5.02(h)(iii) is amended and restated as follows:

                  "(iii) Remediation may make loans to OHM, and either
                  Remediation or OHM may make loans to a wholly owned
                  Subsidiary, which loans are evidenced in the books and records
                  of each such Person, provided that any such loan to a wholly
                  owned Subsidiary shall be on terms and subject to
                  documentation reasonably acceptable to the Administrative
                  Agent and the Issuing and Paying Agent, and

                                       -4-

   5
 


                  shall be assigned to the Issuing and Paying Agent, for the
                  benefit of the Banks, as security for the Obligations;"

                  1.11. SECTION 5.02 (i)(iv) is amended and restated as follows:

                  "(iv) Investments in wholly owned Subsidiaries of either
                  Borrower, each which Investment shall be specifically related
                  to a project directly related to the Borrowers' general line
                  of business as set forth in SECTION 5.02(e), undertaken or to
                  be undertaken by the applicable wholly owned Subsidiary;"

                  1.12. SECTION 5.02(i)(vii) is amended and restated as follows:

                  "(vii) loans to OHM or a wholly owned Subsidiary of OHM or
                  Remediation permitted by SECTION 5.02(h)(iii);"

                  1.13. The word "and" is stricken at the end of SECTION
5.02(i)(viii), the period is stricken at the end of SECTION 5.02(i)(ix), and
replaced by "; and ", and the following is added as SECTION 5.02(i)(x):

                  "(x) Permitted Acquisitions."

                  1.14. SECTION 5.02(j)(ix) is amended and restated as follows:

                  "(ix) Permitted Other Indebtedness; and"

                  1.15. SECTION 5.02(1) is amended by inserting "(other than
Permitted Acquisitions, to the extent any Permitted Acquisition might constitute
a capital expenditure)" after the first reference to "capital expenditures" in
such Section.

                  1.16. SECTION 5.02(O) is amended and restated as follows:

                  "(o) MAXIMUM FUNDED DEBT TO EBITDA RATIO. Permit the Funded
                  Debt to EBITDA Ratio to exceed 3.0 to 1.0 as of the last day
                  of any fiscal quarter of the Borrowers."

                  SECTION 2. WAIVER. On or about June 18, 1997, OHM acquired the
stock of Beneco Enterprises Inc. ("Beneco") for an aggregate consideration of
$15,000,000. the Administrative Agent, the Issuing and Paying Agent and the
Banks waive the violation of SECTION 5.02(i) which resulted from such
acquisition, and agree that such acquisition will be treated as a Permitted
Acquisition.

                  SECTION 3. CONDITIONS PRECEDENT. This Amendment shall become
effective upon the first Business Day upon which the Administrative Agent shall
have received, on or before such date:


                                       -5-

   6
 


                  (i) 12 original counterparts of this Amendment, executed by
         each of the Borrowers, each of the Banks, the Issuing and Paying Agent
         and the Administrative Agent;

                  (ii) 12 original counterparts of an amendment to the Security
         Agreement executed by each of the Borrowers, adding Beneco as a party
         to the Security Agreement and including the grant of a security
         interest by Beneco in substantially all of its personal property;

                  (iii) 12 original counterparts of a guaranty of the
         Obligations, executed by Beneco in favor of the Issuing and Paying
         Agent for the benefit of the Banks;

                  (iv) 12 original counterparts of an amendment to the Pledge
         Agreement previously executed by OHM, adding the stock of Beneco to the
         stock previously pledged thereunder, together with stock certificates
         representing all outstanding shares of stock of Beneco and undated
         stock powers executed in blank covering such certificates;

                  (v) A certificate of the Secretary or an Assistant Secretary
         of each Borrower certifying (a) the names and true signatures of the
         officers of such Person authorized to sign this Amendment and the other
         documents or certificates to be delivered pursuant to this Amendment
         and (b) copies attached thereto of the by-laws of such Person, or, to
         the extent applicable, that such by-laws of such Person have not been
         amended, supplemented or otherwise since May 11, 1993;

                  (vi) Articles/Certificate of Incorporation for Beneco,
         certified by the Secretary of State of the State in which Beneco is
         incorporated;

                  (vii) Requests for Information (form UCC-11) and such other
         search reports (including, without limitation, tax lien and judgment
         searches) regarding Beneco from such jurisdictions as the
         Administrative Agent deems appropriate; and

             (viii) Such other agreements, documents and instruments as shall be
         reasonably requested by the Administrative Agent or the Issuing and
         Paying Agent.

                  SECTION 4. REPRESENTATIONS AND WARRANTIES OF BORROWER;
REAFFIRMATION OF COVENANTS. Each of the Borrowers hereby represents and warrants
that this Amendment has been duly authorized by all necessary corporate action
on the part of such Borrower and constitutes a legal, valid and binding
obligation of such Borrower, enforceable against it in accordance with its
terms.

                  Each of the Borrowers hereby reaffirms all representations,
warranties and covenants made by it in the Credit Agreement, as amended hereby,
except to the extent any of such representations or warranties expressly speak
as of a prior date, and hereby agrees that, subject to the terms hereof, all
such representations, warranties and covenants shall be deemed to have been
re-made as of the effective date of this Amendment.


                                       -6-

   7
 


                  SECTION 5.  EFFECT ON THE CREDIT AGREEMENT.
                              -------------------------------

                  5.1. Upon the effectiveness of this Amendment, each reference
in the Credit Agreement and in each of the other Transaction Documents to "this
Agreement," "hereunder," "hereof," "herein," or words of like import shall mean
and be a reference to the Credit Agreement as amended hereby, and each reference
to the Credit Agreement in any other document, instrument or agreement executed
and/or delivered in connection with the Credit Agreement shall mean and be a
reference to the Credit Agreement as amended hereby.

                  5.2. Except as specifically set forth herein, the Credit
Agreement, each of the other Transaction Documents and all other documents,
amendments, instruments and agreements executed and/or delivered in connection
therewith shall remain in full force and effect and are hereby ratified and
confirmed.

                  5.3. The execution, delivery and effectiveness of this
Amendment shall not operate as a waiver of any right, power or remedy of any of
the Banks, the Issuing and Paying Agent or the Administrative Agent under the
Credit Agreement or any other document, instrument or agreement executed in
connection therewith, nor constitute a waiver of any provision contained
therein, except as specifically set forth herein.

                  SECTION 6. COST, EXPENSES, FEES. Each of the Borrowers hereby
jointly and severally agrees to pay, on demand, all costs, fees and expenses
(including, without limitation, attorneys' fees, court costs, filing charges and
taxes) incurred by, or required to be paid by the Administrative Agent in
connection with the preparation, negotiation, execution, delivery and
administration of this Amendment and all other instruments, documents and
agreements executed and/or delivered pursuant to or in connection herewith.

                  SECTION 7. EXECUTION IN COUNTERPARTS. This Amendment may be
executed by the parties hereto in separate counterparts, each of which when so
executed and delivered shall be deemed to be an original and all of which taken
together shall constitute but one and the same instrument.

                  SECTION 8. GOVERNING LAW. THIS AMENDMENT SHALL BE GOVERNED BY
AND CONSTRUED IN ACCORDANCE WITH THE INTERNAL LAWS (AS OPPOSED TO THE CONFLICT
OF LAWS PROVISIONS) OF THE STATE OF NEW YORK.

                  SECTION 9. SECTION TITLES. Section titles in this Amendment
are included herein for convenience of reference only and shall not affect in
any way the interpretation of any of the provisions hereof.



                                       -7-

   8
 


                  IN WITNESS WHEREOF, the parties hereto have caused this
Amendment to be executed by their respective officers thereunto duly authorized
as of the day and year first written above.

                               BORROWERS:

                               OHM Corporation


Attest:                        By /s/ Pamela K.M. Beall
                                  ----------------------------------
                                 Title:

/s/ Steven E. Harbour
- --------------------------
Secretary
                                   OHM Remediation Services Corp.


                                   By  /s/ Pamela K.M. Beall
                                       ----------------------------------
                                   Title:

                               BANKS:

                                   Citicorp USA, Inc., Individually and as
                                   Administrative Agent
                                                                              
                                                                              
                                   By  /s/ Majorie Futornick                  
                                      ----------------------------------      
                                     Title:  Senior Vice President            
                                                                              
                                   Bank of America National Trust and Savings
                                   Association (successor by merger to Bank of
                                   America Illinois), Individually
                                                                              
                                                                              
                                   By  /s/ Jay McKeown                        
                                      ----------------------------------      
                                     Title:  Assistant Vice President         
                                                                              
                                   Bank of America National Trust and Savings
                                   Association (successor by merger to Bank of
                                   America Illinois), as Issuing and Paying
                                   Agent
                                                                              
                                                                              
                                   By  /s/ Timothy Tepowski
                                      ----------------------------------      
                                     Title:                                   

                                       -8-

   9
 



                                   NBD Bank

                                   By  /s/ Janet Cerca
                                      ------------------------------------
                                     Title:  Vice President

                                   BankBoston, N.A.


                                   By  /s/ Lindsey McSweeney
                                      ------------------------------------
                                     Title:  Vice President

                                   National City Bank


                                   By  /s/ Terri Cable
                                      ------------------------------------
                                     Title:  Vice President

                                   Comerica Bank


                                   By  /s/ Lee Santiona
                                      ------------------------------------
                                     Title:  First Vice President

                                   BHF Bank


                                   By  /s/ John Sykes
                                      ------------------------------------
                                     Title:  Assistant Vice President

                                   BHF Bank


                                   By  /s/ Thomas Scifo
                                      ------------------------------------
                                     Title:

                                   Bank One, N.A.


                                   By  /s/ Ty Koing
                                      ------------------------------------
                                     Title:  Vice President


                                       -9-