1 EXHIBIT 10.17 WAIVER AND AMENDMENT AGREEMENT This Waiver and Amendment Agreement (the "Waiver") is dated as of April 13,1999 and is made by and among UNITED REFINING COMPANY, a Pennsylvania corporation ("United Refining"), UNITED REFINING COMPANY OF PENNSYLVANIA, a Pennsylvania Corporation ("United Refining PA"), KIANTONE PIPELINE CORPORATION, a New York Corporation ("Kiantone, and hereinafter together with United Refining and United Refining PA sometimes collectively referred to as the "Borrowers" and individually as a "Borrower") the BANKS under the Credit Agreement (as hereinafter defined) and PNC BANK, NATIONAL ASSOCIATION, in its capacity as agent for the Banks under the Credit Agreement (hereinafter referred to in such capacity as the "Agent"). RECITALS: WHEREAS, Borrowers, the Banks, and the Agent are parties to that certain Credit Agreement dated as of June 9, 1997 (as previously amended, restated, supplemented or modified, the "Credit Agreement"); and WHEREAS, unless otherwise defined herein, capitalized terms used herein shall have the meanings given to them in the Credit Agreement; and WHEREAS, Borrowers have not complied with the covenant that Consolidated Net Worth may not be less than Base Net Worth contained in Section 7.2.17 (Minimum Net Worth) of the Credit Agreement (the "Section 7.2.17 Violation") during some or all of the period of the fiscal quarter ended February 28, 1999 as more fully disclosed in the Compliance Certificate which Borrowers have delivered or will deliver to the Banks for such fiscal quarter (the "Delivered Compliance Certificate"); and WHEREAS, the Borrowers have requested that the Banks waive the Section 7.2.17 Violation for the fiscal quarter ended February 28, 1999 and amend Section 4.9 of the Credit Agreement, as more fully provided herein. NOW, THEREFORE, in consideration of the foregoing and intending to be legally bound, the parties hereto agree as follows: 1. Warranty. The Borrowers represent and warrant to the Banks that the Delivered Compliance Certificate correctly discloses Borrowers' Consolidated Net Worth to be $38,082,000 and Base Net Worth to be $40,171,000 as of the date and periods set forth in such Delivered Compliance Certificate and that except for the Section 7.2.17 Violation, the Borrowers were in full compliance with the Credit Agreement during the fiscal quarter ended February 28, 1999. 2. Waiver With Respect To Section 7.2.17 Violation. The Banks hereby waive the violation of Section 7.2.17 for the fiscal quarter ended February 28, 1999 subject to Borrowers' warranty in paragraph 1 and the acknowledgments and agreements by the Borrowers in paragraph 4 hereof. 1 2 3. Amendment of Section 4.9. The parties hereto hereby amend and restate Section 4.9 (Receipt and Application of Payment; Cash Collateral Account; Collections; Agent's Right to Notify Account Debtors) to read as follows: The provisions of this Section 4.9 shall apply immediately: 4.9.1 Receipt and Application of Payment. At all times now and hereafter (i) the Agent shall instruct Chase and National City pursuant to the Wire Transfer Agreements to deposit via wire transfer into the Cash Collateral Account all cash, checks and other items of payment received in the Chase Lockbox or National City Lockbox, as the case may be, within 24 hours of Chase's or National City's receipt thereof, net of any items presented for payment (ii) all cash, checks or other items of payment received in the PNC Lockbox shall be immediately deposited into the Cash Collateral Account promptly upon PNC's receipt thereof, and (iii) the Borrowers shall deposit into the Cash Collateral Account within 24 hours of Borrowers' receipt thereof all cash, checks or other items of payment received from those Account Debtors not currently making payment into a Lockbox or, promptly upon request of the Agent, shall cause such Account Debtors to deposit such cash, checks or other items of payment directly into one of the Lockboxes. In the event a Borrower (or any of its Affiliates, shareholders, directors, officers, employees, agents or those persons acting for or in concert with a Borrower) shall receive any cash, checks, notes, drafts or other similar items of payment relating to or constituting the Collateral (or proceeds thereof), no later than the first Business Day following receipt thereof, such Borrower shall (i) deposit or cause the same to be deposited, in kind, in the Cash Collateral Account established by such Borrower with the Agent or such other depository as may be designated in writing by the Agent (the "Depository"), from which account the Agent alone shall have the power of withdrawal, and with respect to which the Depository shall waive any rights of set off, and (ii) at the Agent's request, forward to the Agent, on a daily basis, a collection report in form and substance satisfactory to the Agent and copies of all such items and deposit slips related thereto. 4.9.2 Cash Collateral Account The Agent alone shall have the sole power of withdrawal from the Cash Collateral Account, to be exercised as follows: (a) Provided no Event of Default shall have occurred and be continuing, and provided that no Potential Default with respect to the covenants set forth in Sections 7.1.2, 7.2.1, 7.2.16 and 7.2.17 shall have occurred and be continuing, the Agent shall withdraw all funds in the Cash Collateral Account at the end of each Business Day and deposit such funds into a designated general deposit account maintained by Borrowers with the Agent. 2 3 (b) Upon the occurrence of an Event of Default, or upon the occurrence of a Potential Default with respect to the covenants set forth in Sections 7.1.2, 7.2.1, 7.2.16 and 7.2.17, and for so long as such Event of Default or Potential Default shall be continuing, the Agent in the exercise of its sole discretion may withdraw all funds in the Cash Collateral Account at the end of each Business Day ad deposit such funds into a designated general deposit account maintained by Borrowers with the Agent. All cash notes, checks, drafts or similar items of payment by or for the account of a Borrower deposited into the Cash Collateral Account and not withdrawn at the end of any Business Day in accordance with the previous sentence shall be deemed the sole and exclusive property of the Banks immediately upon the earlier of the receipt of such items by the Agent or the Depository or the receipt of such items by such Borrower; provided, however, that for the purpose of computing interest hereunder such items shall be deemed to have been collected and shall be applied by the Agent on account of the Revolving Credit Loans outstanding to such Borrower one (1) Business Day after receipt by the Agent (subject to correction for any items subsequently dishonored for any reason whatsoever). Notwithstanding anything to the contrary herein, all such items of payment shall, solely for purposes of determining the occurrence of such Event of Default, be deemed received upon actual receipt by the Agent, unless the same are subsequently dishonored for any reason whatsoever, and all funds in the Cash Collateral Account, including all payments made by or on behalf of and all credits due a Borrower, may be applied and reapplied in whole or in part to any of the Revolving Credit Loans to the extent and in the manner the Agent deems advisable. 4.9.3 Collections: Agent's Right to Notify Account Debtors. The Borrowers hereby authorize the Agent now and at all times hereafter, to (i) after the occurrence of an Event of Default, notify any or all Account Debtors that the Accounts have been assigned to the Banks and that the Banks have a security interest therein, and to (ii) direct such Account Debtors to make all payments due from them to each Borrower upon the Accounts directly to the Agent, to the Lockboxes or to any other lockbox designated by the Agent. The Agent shall promptly furnish the Borrowers with a copy of any such notice sent. Any such notice, in the Agent's sole discretion, may be sent on the Borrowers' stationery, in which event the appropriate Borrower shall co-sign such notice with the Agent. To the extent that any Law or custom or any contract with any Account Debtor requires notice to or the approval of the Account Debtor in order to perfect such assignment of a security interest in Accounts, each Borrower agrees to give such notice or obtain such approval. 4. Full Force and Effect. All provisions of the Credit Agreement remain in full force and effect on and after the date hereof. The Banks do not amend or waive any provisions of the Credit Agreement except as expressly amended or waived hereby. Without limiting the foregoing, the Banks retain all rights given to the Banks under the Credit Agreement and under applicable law in connection with any failure by the Borrower to comply with the Credit Agreement as amended hereby. The foregoing rights expressly include, without limitation, any rights given 3 4 to the Banks under Section 8.2 if a Potential Default or an Event of Default arises as a result of any such failure to comply. 5. Borrowing Base. The definition of "Borrowing Base" contained in Section 1.1 of the Credit Agreement is hereby amended and restated to read as follows: Borrowing Base shall mean at any time the sum of (i) one hundred percent (100%) of cash held in the Cash Collateral Account, the Borrower's general deposit account into which funds withdrawn from the Cash Collateral Account are deposited pursuant to Section 4.9.2 hereof and any overnight sweep investment account into which any of Borrower's funds swept from such accounts are deposited, plus (ii) eighty percent (80%) of Qualified Accounts ("Accounts Portion"), plus (iii) the lesser of (A) seventy percent (70%) of Qualified Inventory ("Inventory Portion"), or (B) one hundred fifty percent (150%) of the Accounts Portion. 6. Waiver and Amendment Fee. The Borrowers' shall pay to the Agent for the accounts of the Banks based on their Ratable Shares, as consideration for the Banks' waiver of the Section 7.2.17 Violation and the other changes being made to the Credit Agreement hereunder, a nonrefundable fee equal to $17,500 payable on the Effective Date as hereinafter defined. 7. Counterparts: Effective Date. This Waiver may be signed in counterparts. This Waiver shall become effective as of the date first above written when it has been executed by the Borrowers, the Agent and the Required Banks. The Borrowers agree to cooperate with the Agent to implement the provisions of Section 4.9 as amended hereby as soon as practicable, but in any event no later than May 13, 1999. [SIGNATURES BEGIN ON NEXT PAGE] 4 5 [SIGNATURE PAGE 1 OF 1 TO WAIVER AND AMENDMENT AGREEMENT] The undersigned have executed this Waiver as of the date first above written. UNITED REFINING COMPANY, a Pennsylvania corporation By: /s/ James E. Murphy --------------------------------------------- Title: V.P. - Finance and Chief Financial Officer UNITED REFINING COMPANY OF PENNSYLVANIA, a Pennsylvania corporation By: /s/ James E. Murphy --------------------------------------------- Title: V.P. - Finance and Chief Financial Officer KIANTONE PIPELINE CORPORATION, a New York corporation By: /s/ James E. Murphy --------------------------------------------- Title: V.P. - Finance and Chief Financial Officer PNC BANK, NATIONAL ASSOCIATION, Individually and as Agent By: /s / Richard Munsick --------------------------------------------- Title: Vice President MANUFACTURERS AND TRADERS TRUST COMPANY By: /s/ C. Gregory Vogelsang --------------------------------------------- Title: Assistant Vice President NATIONAL BANK OF CANADA By: /s/ Eric L. Moore --------------------------------------------- Title: Vice President By: /s/ Donald P. Haddad --------------------------------------------- Title: Vice President 5