EXHIBIT 10.52 AMENDED AND RESTATED TERM LOAN AGREEMENT (LYLES DIVERSIFIED, INC. - PACIFIC ETHANOL MADERA LLC) THIS AMENDED AND RESTATED TERM LOAN AGREEMENT (this "Agreement") is made effective as of April 13, 2006, by and between LYLES DIVERSIFIED, INC., a California corporation ("Lender") and PACIFIC ETHANOL MADERA LLC, a Delaware limited liability company ("Borrower"). R E C I T A L S: - - - - - - - - A. Pacific Ethanol California, Inc., a California corporation (formerly known as Pacific Ethanol, Inc., "PEI California") and Borrower are, respectively, direct and indirect wholly-owned subsidiaries of Pacific Ethanol, Inc., a Delaware corporation ("PEIX"). B. PEI California and Lender are parties to the Term Loan Agreement, dated as of June 16, 2003 (the "Original Agreement"); the Original Agreement was assigned to PEIX by PEI California pursuant to the Assignment of Term Loan Agreement and Deed of Trust, dated as of March 23, 2005, by and among PEIX, PEI California, William L. Jones and Lender. C. PEI California owns certain real property consisting of approximately 137 acres located in Madera County, California, on Avenue 12 about four miles east of Highway 99 (the "Real Property"). The Real Property includes certain improvements and fixtures, including, but not limited to, a grain storage and processing facility, an office building, and two railroad sidings. Concurrently with the execution of this Agreement, PEI California will contribute the Real Property to Borrower pursuant to a grant deed. D. Borrower is developing a denatured ethanol production facility on the Real Property (the "Madera Facility"). Borrower and its affiliates intend, at some future date, to construct a second ethanol production facility in California (the "Second Facility"). Borrower has selected W.M. Lyles Co. ("Builder") as the general contractor for the Madera Facility and the Second Facility. Lender is the parent company of Builder. Borrower and Builder are parties to the Amended and Restated Phase 1 Design-Build Agreement and the Phase 2 Design-Build Agreement, each dated as of November 2, 2005 (collectively, the "Design-Build Contract"), pursuant to which Builder is providing design-build services to Borrower for the construction of the Madera Facility. Borrower or one of its affiliates and Builder intend, at a later date, to enter into a second design-build contract for the Second Facility. E. Borrower will obtain the financing necessary to complete the construction of the Madera Facility pursuant to the Construction and Term Loan Agreement of even date herewith (the "HUD Loan Agreement") by and among Borrower, the lenders from time to time party thereto and Hudson United Capital, a Division of TD Banknorth, N.A., a national banking association, as administrative agent for the lenders (the "Administrative Agent"). F In order for Borrower to complete the financing for the construction of the Madera Facility, Lender has agreed to amend and restate the Original Agreement to, among other things, (i) transfer the loan from PEIX to Borrower and (ii) subordinate its rights, remedies and security interest hereunder and under the Deed of Trust (as defined herein) to the rights, remedies and security interest of the lenders under the HUD Loan Agreement. NOW THEREFORE, in consideration of the mutual terms and conditions contained herein, the parties agree as follows: SECTION 1 FACILITIES 1.1 THE TERM LOAN: Lender agrees to make a term loan to Borrower in the amount of $5,100,000.00. The credit facility described in this Section shall be referred to below as the "Term Loan". Borrower will pay interest on all amounts owing under the Term Loan until payment in full of any principal outstanding thereunder. Lender and Borrower acknowledge and agree that, as of the date hereof, the outstanding principal amount of the term loan is $3,600,000. 1.2 INITIAL ADVANCE; DEPOSIT: On March 24, 2003 Lender made an initial advance to Borrower under the Term Loan in the principal amount of $510,000.00, which PEI California used as a good-faith deposit for the purchase of the Real Property (the "Deposit"). Interest will accrue from March 24, 2003 on the principal amount of the Deposit, at the rates indicated in Paragraph 1.3 of this Agreement. 1.3 REPAYMENT TERMS: (a) INTEREST RATE. Interest under the Term Loan will accrue at the following rates: (1) A rate of five percent (5.00%) per annum through June 19, 2004. (2) A rate per annum equal to the "Wall Street Journal Prime Rate" (as defined in Section 1.2(b)) plus two percentage points (2.00%) from June 20, 2004 until the Maturity Date (as defined in Section 1.3(d)). (b) DEFINITION OF WALL STREET JOURNAL PRIME RATE. The "Wall Street Journal Prime Rate" for any day is a fluctuating rate of interest equal to the highest rate published from time to time in the "Money Rates" section of The Wall Street Journal as the Prime Rate for such day (or, if such source is not available, such alternate source as determined by Lender). (c) COMPUTATION AND PAYMENT OF INTEREST. Interest shall be based on a 365 day year and compounded monthly. Interest shall be paid monthly commencing on June 20, 2004, and continuing on the twentieth (20th) day of each month thereafter. If interest is not paid as it becomes due, it may be added to, become and be treated as a part of the principal, and shall thereafter bear like interest. 2 (d) PRINCIPAL PAYMENTS/MATURITY DATE. One third of the principal outstanding on June 20, 2006 shall be paid on that date. Half of the principal outstanding on June 20, 2007 shall be paid on that date. All remaining outstanding principal, together with any accrued interest thereon, shall be due and payable on June 20, 2008, (the "Maturity Date"). (e) ADDITIONAL PRINCIPAL PAYMENTS. Borrower shall be required to prepay the principal owing under the Term Loan in the following circumstances: (i) should the construction cost for the Madera Facility to be constructed on the Real Property be less than $42.6 million then Borrower shall promptly pay lender the difference between the actual construction cost and $42.6 million; and (ii) should Borrower or any of its affiliates obtain construction funding for the Second Facility, Borrower shall promptly pay Lender all principal and accrued interest then outstanding. 1.4 PREPAYMENT: Borrower may prepay any amount owing under the Term Loan, in whole or in part, at any time and without penalty, provided, however, that any partial prepayment shall first be applied, at Lender's option, to accrued and unpaid interest and next to the outstanding principal balance. 1.5 [INTENTIONALLY OMITTED.] 1.6 PAYMENT: If any payment required to be made by Borrower hereunder becomes due and payable on a day other than a Business Day (as defined below), the due date thereof shall be extended to the next succeeding Business Day and interest thereon shall be payable at the then applicable rate during such extension. Both principal and interest are payable in lawful money of the United States of America in same day funds at any place that Lender may, from time to time, in writing designate. "Business Day" shall mean a day, other than a Saturday or Sunday, on which commercial Lenders are open for business in California. 1.7 DEFAULT RATE: If any amount owing under the Term Loan is not paid when due, whether at stated maturity, by acceleration, or otherwise, will bear interest from the date on which that amount is due until the amount is paid in full, payable on demand, at a rate which is two percent (2.00%) in excess of the rate or rates then in effect (the "Default Rate"). 1.8 LATE PAYMENT: In addition to any other rights Lender may have hereunder, if any payment of principal or interest, or any portion thereof, under this Agreement is not paid in accordance with the terms herein, a late payment charge equal to five percent (5%) of such past due payment may be assessed and shall be immediately payable. SECTION 2 COLLATERAL, SUBORDINATION AND GUARANTY 2.1 REAL PROPERTY SECURITY: Borrower agrees to execute and deliver to Lender a deed of trust dated concurrently with this Agreement (the "Deed of Trust") granting to Lender a security interest in the Real Property (the "Collateral"), to secure the payment and performance of the obligations 3 hereunder. Notwithstanding any provision to the contrary herein, Lender acknowledges and agrees that the lien created by the Deed of Trust is subject and subordinate to the lien created by that certain Deed of Trust, Assignment of Lease and Rents and Security Agreement of even date herewith, made by Borrower to Chicago Title Company, as trustee, for the benefit of the Administrative Agent, as beneficiary. 2.2 SUBORDINATION TO FINANCING: Notwithstanding any provision to the contrary herein, Lender acknowledges and agrees that all of its rights and remedies under this Agreement shall be governed by, and subject to, that certain Intercreditor and Collateral Sharing Agreement of even dated herewith by and between Lender and the Administrative Agent. 2.3 [INTENTIONALLY OMITTED.] 2.4 ADDITIONAL CONSIDERATION: As additional consideration, Borrower agrees it will, or will cause its affiliates to engage Lender at the appropriate time, on mutually acceptable terms substantially similar to the Design-Build Contract for the Madera Facility, on a design-build agreement for the Second Facility irrespective of whether the Term Loan is repaid at the time Borrower or its affiliates is prepared to contract for the design and construction of that facility. SECTION 3 CONDITIONS OF LENDING 3.1 CONDITIONS PRECEDENT TO THE EFFECTIVENESS OF THIS AGREEMENT: The effectiveness of this Agreement is subject to the conditions precedent that Lender shall have received, before making such Term Loan, all of the following, in form and substance satisfactory to Lender: (a) Evidence that the execution, delivery and performance by Borrower of the "Loan Documents" (as defined below) have been duly authorized. The term "Loan Documents" shall mean this Agreement, the Deed of Trust, and all other documents or instruments entered into between either Borrower and Lender, or by Borrower in favor of, or for the benefit of Lender, that recite that they are to secure the Obligations; (b) The executed Deed of Trust; (c) Lender holds a duly authorized, created and perfected security interest in the Collateral; and (d) The representations contained in Section 4 and in any other document, instrument or certificate delivered to Lender hereunder are true, correct and complete. 3.2 CONSENT OF OBLIGEES: As long as any principal amount of the Term Loan remains due and owing to Lender, consent of at least a majority of the obligees thereunder shall be required for any action that: 4 (a) alters or changes the rights, preferences or privileges of such obligees; or (b) amends or waives any provision contained in any document evidencing Borrower's corporate existence, including, but not limited to, articles of incorporation and by-laws, related to the Obligations hereunder. SECTION 4 REPRESENTATIONS AND WARRANTIES Borrower hereby makes the representations and warranties to Lender set forth in this Section. Borrower agrees that each representation and warranty is continuing. 4.1 STATUS: Borrower is a limited liability company, duly formed and validly existing under the laws of the State of Delaware. 4.2 AUTHORITY: The execution, delivery and performance by Borrower of the Loan Documents have been duly authorized and do not and will not: (i) violate any provision of any law, rule, regulation, order, writ, judgment, injunction, decree, determination or award presently in effect having application to Borrower, or (ii) result in a breach of or constitute a default under any material indenture or loan or credit agreement or other material agreement, lease or instrument to which Borrower is a party or by which it or its properties may be bound or affected. 4.3 LEGAL EFFECT: The Loan Documents, and any instrument, document or agreement required thereunder, when delivered to Lender, will constitute, legal, valid and binding obligations of Borrower and are enforceable against Borrower in accordance with their respective terms. 4.4 FINANCIAL STATEMENTS: All financial statements, information and other data which may have been or which may hereafter be submitted by Borrower to Lender are true, accurate and correct and have been or will be prepared in accordance with generally accepted accounting principles consistently applied and accurately represent the financial condition or, as applicable, the other information disclosed therein. Since the most recent submission of such financial information or data to Lender, Borrower represents and warrants that no material adverse change in Borrower's financial condition or operations has occurred which has not been fully disclosed to Lender in writing. 4.5 LITIGATION: Except as have been disclosed to Lender in writing, there are no actions, suits or proceedings pending or, to the knowledge of Borrower, threatened against or affecting Borrower or its properties before any court or administrative agency which, if determined adversely to Borrower, would have a material adverse effect on Borrower's financial condition or operations or on the Collateral. 4.6 TITLE TO ASSETS; PERMITTED LIENS: Borrower has good and marketable title to all of its assets and the same are not subject to any security interest, encumbrance, lien or claim of any third person other than: (i) liens and security interests securing indebtedness owed by Borrower to 5 Lender; (ii) liens for taxes, assessments or similar charges either not yet due or being duly contested in good faith; (iii) liens of mechanics, materialmen, warehousemen or other like liens arising in the ordinary course of business and securing obligations which are not yet delinquent; (iv) liens and security interests which, as of the date of this Agreement, have been disclosed to and approved by Lender in writing; (v) purchase money liens or purchase money security interests upon or in any property acquired or held by Borrower in the ordinary course of business to secure indebtedness outstanding on the date hereof or permitted to be incurred hereunder; (vi) liens in favor of any lender providing annual crop financing to Borrower; (vii) those liens and security interests which in the aggregate constitute an immaterial and insignificant monetary amount with respect to the net value of Borrower's assets, and (viii) liens permitted under the HUD Loan Agreement (collectively "Permitted Liens"). SECTION 5 COVENANTS Borrower covenants and agrees that, during the term of this Agreement, and so long thereafter as Borrower is indebted to Lender under this Agreement, Borrower will, unless Lender shall otherwise consent in writing: 5.1 [INTENTIONALLY OMITTED.] 5.2 REPORTING AND CERTIFICATION REQUIREMENTS: Borrower shall deliver or cause to be delivered to Lender, so long as five percent of the total amount of the Term Loan (principal and accrued interest) remains outstanding, the following financial and other information: (a) Not later than 120 days after the end of each of Borrower's fiscal years, a copy of Borrower's annual financial report for such year. (b) Not later than 60 days after the end of each of Borrower's fiscal quarters, a copy of Borrower's financial report for that quarter. (c) Not later than February 15 of any year, provide monthly cash flow and budget projections for such calendar year beginning. 5.3 PRESERVATION OF EXISTENCE; COMPLIANCE WITH APPLICABLE LAWS: Maintain and preserve the existence of its business and all rights and privileges now enjoyed; and conduct its business and operations in accordance with all applicable laws, rules and regulations. 5.4 MAINTENANCE OF INSURANCE: Maintain insurance in such amounts and covering such risks as is usually carried by companies engaged in similar businesses and owning similar properties in the same general areas in which Borrower owns property. With respect to insurance covering properties in which Lender maintains a security interest or lien, such insurance shall name Lender as loss payee pursuant to a loss payable endorsement satisfactory to Lender and shall not be altered or canceled except upon 30 days' prior written notice to Lender. 6 5.5 INSPECTION RIGHTS: Lender may, at any reasonable time and from time to time, conduct inspections and audits of the Collateral. 5.6 [INTENTIONALLY OMITTED.] 5.7 [INTENTIONALLY OMITTED.] 5.8 NOTICE: Give Lender prompt written notice of any and all (i) Events of Default; (ii) litigation, arbitration or administrative proceedings to which Borrower is a party or which affects the Collateral, and in which the claim or liability exceeds $500,000.00; (iii) other matters which have resulted in, or might result in a material adverse change in the Collateral or the financial condition or business operations of Borrower. SECTION 6 EVENTS OF DEFAULT Any one or more of the following described events shall constitute an event of default (an "Event of Default") under this Agreement: 6.1 NON-PAYMENT: Borrower shall fail to pay any Obligations when due. 6.2 NON-PERFORMANCE: Borrower shall fail in any material respect to perform or observe any term, covenant or agreement contained in the Loan Documents and any such failure shall continue unremedied for more than 60 days after the occurrence thereof. 6.3 REPRESENTATIONS AND WARRANTIES; FINANCIAL STATEMENTS: Any representation or warranty made by Borrower under or in connection with the Loan Documents or any financial statement given by Borrower, or any representation made by Borrower in any other document, instrument or certificate provided to Lender, shall prove to have been incorrect in any material respect when made or given or when deemed to have been made or given. 6.4 INSOLVENCY: Borrower shall: (i) become insolvent or be unable to pay its debts as they mature; (ii) make an assignment for the benefit of creditors or to an agent authorized to liquidate any substantial amount of its properties and assets; (iii) file a voluntary petition in Lenderruptcy or seeking reorganization or to effect a plan or other arrangement with creditors; (iv) file an answer admitting the material allegations of an involuntary petition relating to Lenderruptcy or reorganization or join in any such petition; (v) become or be adjudicated a Lenderrupt; (vi) apply for or consent to the appointment of, or consent that an order be made, appointing any receiver, custodian or trustee, for itself or any of its properties, assets or businesses; or (vii) any receiver, custodian or trustee shall have been appointed for all or substantial part of its properties, assets or businesses and shall not be discharged within 60 days after the date of such appointment. 6.5 EXECUTION: Any writ of execution or attachment or any judgment lien shall be issued against any property of either Obligor and shall not be discharged or bonded against or released within 60 days after the issuance or attachment of such writ or lien. 7 6.6 SUSPENSION: Borrower shall voluntarily suspend the transaction of business or allow to be suspended, terminated, revoked or expired any permit, license or approval of any governmental body necessary to conduct Borrower's business as now conducted. SECTION 7 REMEDIES ON DEFAULT Upon the occurrence of any Event of Default, Lender may, at its sole and absolute election, without demand and only upon such notice as may be required by law: 7.1 ACCELERATION: Declare any or all of Borrower's indebtedness owing to Lender, whether under this Agreement or any other document, instrument or agreement, immediately due and payable, whether or not otherwise due and payable. 7.2 PROTECTION OF SECURITY INTEREST: Make such payments and do such acts as Lender, in its sole judgment, considers necessary and reasonable to protect its security interest or lien in the Collateral. Borrower hereby irrevocably authorizes Lender to pay, purchase, contest or compromise any encumbrance, lien or claim which Lender, in its sole judgment, deems to be prior or superior to its security interest. 7.3 FORECLOSURE: Enforce any security interest or lien given or provided for under this Agreement or under any security agreement, mortgage, deed of trust or other document, in such manner and such order, as to all or any part of the properties subject to such security interest or lien, as Lender, in its sole judgment, deems to be necessary or appropriate and Borrower hereby waives any and all rights, obligations or defenses now or hereafter established by law relating to the foregoing. SECTION 8 MISCELLANEOUS 8.1 FURTHER ASSURANCES: From and after the date of this Agreement, Lender and Borrower agree to do such things, perform such acts, and make, execute, acknowledge and deliver such documents as may be reasonably necessary or proper and usual to carry out the purpose of the Loan Documents in accordance with their terms. 8.2 SURVIVAL OF REPRESENTATIONS: All representations, warranties, covenants, agreements, terms and conditions made herein shall survive the execution, delivery and closing of this Agreement and all transactions contemplated hereunder. 8.3 NOTICES: Any notice herein required or permitted to be given shall be in writing and may be (i) personally served, (ii) sent by United States mail and shall be deemed to have been given when deposited in the United States mail, registered or certified, with return receipt requested, with postage prepaid and properly addressed or (iii) sent by an established commercial courier service with written acknowledgment of receipt requested. For the purposes hereof, the addresses of the parties hereto (until notice of a change thereof is served as provided in this section) shall be as follows: 8 To Borrower: To Lender: PACIFIC ETHANOL MADERA LLC LYLES DIVERSIFIED, INC. 5711 North West Avenue Post Office Box 4376 Fresno, California 93711 Fresno, California 93744 Fax: (559) 435-1478 Fax: (559) 487-7948 8.4 DESCRIPTIVE HEADINGS: The descriptive headings of the several sections of this Agreement are inserted for convenience and shall not be deemed to affect the meaning or construction of any of the provisions hereof. 8.5 COSTS AND EXPENSES: Lender and Borrower shall each pay their own respective costs and expenses incurred, or to be incurred, by said party in negotiating and preparing this Agreement, and all exhibits hereto, and in closing and carrying out the transactions contemplated by this Agreement (including, without limitation, attorneys', paralegals', and other professionals' fees and costs). 8.6 SEVERABILITY: In case any provision in this Agreement shall be invalid, illegal or unenforceable, the validity, legality and enforceability of the remaining provisions shall not in any way be affected or impaired thereby. 8.7 AMENDMENT PROVISION: The term "Agreement" or "this Agreement" and all reference thereto as used throughout this instrument shall mean this instrument as originally executed or, if later amended or supplemented, then as so amended or supplemented. Any amendment to this Agreement must be in writing signed by the party to be charged. 8.8 COUNTERPARTS: This Agreement may be executed in counterparts, each of which shall be an original, but all of which shall constitute one and the same Agreement. 8.9 APPLICABLE LAW: The Loan Documents and the rights and obligations of the parties thereto shall be governed by the laws of the State of California except to the extent that Lender has greater rights or remedies under federal law, in which case such choice of California law shall not be deemed to deprive Lender of such rights and remedies as may be available under federal law. 8.10 ASSIGNABILITY: The Loan Documents shall be binding upon the parties hereto and their respective successors and assigns, and shall inure to the benefit of the parties hereto and the successors and assigns of Lender. Lender may transfer or assign all or part of its interest hereunder to one or more of Lender's affiliated partnerships or funds managed by it or any of their respective directors, officers or partners. 8.11 INTEGRATED AGREEMENT: The Loan Documents constitute the entire and integrated agreement between Lender and Borrower relating to the Term Loan and all matters addressed herein and supersede all prior negotiations, communications, understandings and commitments relating thereto, whether written or oral. 9 8.12 JURY TRIAL WAIVER; REFERENCE: In any judicial action or proceeding arising from or relating to this Agreement or the other Loan Documents, including any action or proceeding involving a claim based on or arising from an alleged tort, (i) Lender and Borrower hereby waive any right it or they may have to request or demand a trial by jury and (ii) if the action is before a court of any judicial district of the State of California, either Lender or Borrower may elect to have all decisions of fact and law determined by a reference in accordance with California Code of Civil Procedure section 638 ET SEQ. If such an election is made, the parties shall designate to the court referee or referees selected under the auspices of the American Arbitration Association in the same manner as arbitrators are selected in Association-sponsored proceedings. The presiding referee of the panel, or the referee if there is a single referee, shall be an active attorney or retired judge. Judgment upon the award rendered by such referee or referees shall be entered in the court in which such proceeding was commenced in accordance with California Code of Civil Procedure sections 644 and 645. 8.13 VENUE: Venue for any action hereunder shall be in an appropriate court in Fresno, California, selected by Lender to which Borrower hereby. [SIGNATURES ON FOLLOWING PAGE] 10 IN WITNESS WHEREOF, the parties hereto have caused this Amended and Restated Term Loan Agreement to be executed as of the date first above written. LENDER: BORROWER: LYLES DIVERSIFIED, INC., a California PACIFIC ETHANOL MADERA LLC, a corporation Delaware limited liability company By: /S/ WILLIAM M. LYLES, IV By: /S/ RYAN TURNER --------------------------------------------- -------------------------------------------- Name: William M. Lyles, IV Name: Title: Vice President Title: By: /S/ MICHAEL F. ELKINS By: /S/ JEFFREY MANTERNACH --------------------------------------------- -------------------------------------------- Name: Michael F. Elkins Name: Title: Vice President/CFO Title: