EXHIBIT 10.4
 
EXECUTION COPY

AMENDED AND RESTATED SECURITY AGREEMENT

THIS AMENDED AND RESTATED SECURITY AGREEMENT (this “Agreement”) is made as of
the 6th day of July, 2012 by (i) AEMETIS ADVANCED FUELS KEYES, INC. (f/k/a AE
Advanced Fuels Keyes, Inc.), a Delaware corporation (“AEAFK”), (ii) AEMETIS,
Inc. (f/k/a AE Biofuels, Inc.), a Nevada corporation (“Parent”), (iii) BIOFUELS
MARKETING, INC., a Delaware corporation, (iv) AEMETIS BIOCHEMICALS INC., a
Nevada corporation, (v) AEMETIS INTERNATIONAL, INC. (f/k/a International
Biodiesel, Inc.), a Nevada corporation, (vi) AEMETIS TECHNOLOGIES, INC. (f/k/a
AE Zymetis, Inc.), a Delaware corporation, (vii) AEMETIS BIOFUELS, INC. (f/k/a
AE Biofuels Technologies, Inc.), a Delaware corporation, (viii) AE ADVANCED
FUELS, INC., a Delaware corporation, (ix) AEMETIS ADVANCED FUELS, INC., a Nevada
corporation, (x) AEMETIS AMERICAS, INC. (f/k/a American Ethanol, Inc.), a Nevada
corporation, (xi) ENERGY ENZYMES, INC., a Delaware corporation, (xiii) KEYES
FACILITY ACQUISITION CORP., a Delaware corporation to be merged with and into
Cilion, Inc., a Delaware corporation and to be known as Aemetis Facility Keyes,
Inc. (“Cilion Acquisition Corp.”, and together with AEAFK, the “Borrowers”, and
each a “Borrower”), and (xii) AE BIOFUELS, INC., a Delaware corporation (such
parties collectively, the “Debtors”, and each a “Debtor”) having a mailing
address at 20400 Stevens Creek Boulevard, Suite 700, Cupertino,
California  95014, for the benefit and security of THIRD EYE CAPITAL
CORPORATION, as Agent for the Noteholders are party to the Amended and Restated
Purchase Agreement defined below (together with its successors and assigns,
“Secured Party”).
 
RECITALS
 
A. Pursuant to (i) that certain Note and Warrant Purchase Agreement dated May
16, 2008 among Parent, Agent, and the Noteholders party thereto (including all
amendments and modifications thereto, the “Parent Purchase Agreement”), Debtor
executed and delivered that certain Security Agreement dated as of May 16, 2008
(including all amendments and modifications thereto, the “Original Parent
Security Agreement”) in favor of Agent to secure all obligations under the
Parent Purchase Agreement as set forth in the Original Parent Security Agreement
and (ii) that certain Note Purchase Agreement dated October 18, 2010 among
AEAFK, Agent, and the Noteholders party thereto (including all amendments and
modifications thereto, the “AEAFK Purchase Agreement”), Debtor executed and
delivered that certain Security Agreement dated as of October 18, 2010
(including all amendments and modifications thereto, the “Original AEAFK
Security Agreement”, and together with the Original Parent Security Agreement,
the “Original Security Agreement”) in favor of Agent to secure all obligations
under the AEAFK Purchase Agreement as set forth in the Original AEAFK Security
Agreement.
 
B. AEAFK, Cilion Acquisition Corp., the Agent and the Noteholders from time to
time party thereto are entering into an Amended and Restated Note Purchase
Agreement (as defined below) pursuant to which the Noteholders will provide
certain financial accommodations to the Borrowers as set forth in the Amended
and Restated Purchase Agreement.
 
 
1

--------------------------------------------------------------------------------

 
 
C. In consideration of the financing and other financial accommodations being
made to the Borrowers pursuant to the Amended and Restated Purchase Agreement
and as a condition to entering into the Amended and Restated Purchase Agreement,
each Debtor has agreed to amend and restate the Original Security Agreement and
execute and deliver this Agreement.
 
ACCORDINGLY, in consideration of the foregoing, and for other good and valuable
consideration, the receipt and sufficiency of which are hereby acknowledged, it
is hereby agreed that:
 
ARTICLE I
 
CONSTRUCTION AND DEFINED TERMS
 
1.01           Defined Terms.  Unless otherwise expressly stated in this
Agreement: (a) capitalized terms which are not otherwise defined herein shall
have the meanings assigned thereto in the Amended and Restated Purchase
Agreement; and (b) “Account”, “Account Debtor”, “Chattel Paper”, “Commercial
Tort Claims”, “Deposit Accounts”, “Documents”, “Equipment”, “Fixtures”, “General
Intangibles”, “Goods”, “Instruments”, “Inventory”, “Investment Property”,
“Letter of Credit Rights” and “Proceeds” shall have the respective meanings
assigned to such terms, as of the date of this Agreement, in the Delaware
Uniform Commercial Code (the “UCC”), as it may be revised from time to time;
provided that if, and to the extent that, the Uniform Commercial Code of a
jurisdiction other than Delaware governs the perfection, the effect of
perfection or non-perfection, or the priority of a security interest created
under this Agreement, then “UCC” shall refer to the Uniform Commercial Code of
such other jurisdiction to the extent applicable to the perfection, the effect
of perfection or non-perfection, or the priority of such security interest.
 
 “Amended and Restated Purchase Agreement” means the Amended and Restated Note
Purchase Agreement of even date herewith as the same shall be amended from time
to time in accordance with the terms thereof, by and among Debtors, Secured
Party and the Noteholders from time to time party thereto, together with the
Exhibits and Schedules attached thereto.
 
"Secured Obligations" means all present and future obligations and liabilities
(whether actual or contingent, whether owed jointly or severally or alone or in
any other capacity whatsoever) of Debtor and each Affiliate or Subsidiary of
Debtor (or any of them) under or pursuant to each or any of the Note Purchase
Documents (each as amended or restated from time to time) together with all
costs, charges and expenses incurred by Secured Party in connection with the
protection, preservation or enforcement of its respective rights under the
Amended and Restated Purchase Agreement, the Notes and any other Note Purchase
Documents or any other document evidencing or securing any such liabilities.
 
 
2

--------------------------------------------------------------------------------

 
 
ARTICLE II
 
SECURITY INTEREST;  PERFECTION
 
2.01           Security Interest.  To secure the full and timely payment,
performance and satisfaction of the Secured Obligations, each Debtor does hereby
pledge, assign, transfer and deliver to Secured Party and does hereby grant to
Secured Party a continuing and unconditional security interest in and to the
property of such Debtor, whether now existing or hereafter acquired, and
wherever now or hereafter located, and the products and proceeds therefrom
(collectively, the “Collateral”), described as follows:
 
(a)           All Accounts, and all Goods, repossessed from or returned by an
Account Debtor, whose sale, lease, or other disposition by Debtor have given
rise to Accounts;

(b)           All Inventory; all Goods, other than Inventory;

(c)           All Equipment, Vehicles, furniture and Fixtures;

(d)           All Chattel Paper, Instruments, Documents, Deposit Accounts,
General Intangibles and Investment Property;

(e)           All Commercial Tort Claims identified on Schedule 2.01 attached
hereto and all Letter of Credit Rights;

(f)           All books and records (including, without limitation, customer
lists, credit files, computer programs, print-outs and other computer materials
and records) of such Debtor pertaining to any of the foregoing; and

(g)           All products and Proceeds of any of the foregoing, including,
without limitation, all insurance policies and proceeds insuring the foregoing
property or any part thereof, including unearned premiums.

           2.02           Perfection by Filing.
 
(a)           Promptly upon Secured Party’s request from time to time, each
Debtor shall deliver to Secured Party any financing statement or other document,
and shall use commercially reasonable efforts to cause any third party to
execute and deliver to Secured Party any other document (including financing
statement termination statements), reasonably requested by Secured Party to
perfect the security interests created under this Agreement and to establish,
maintain, and continue the first priority of the security interests created
under this Agreement.
 
(b)           Secured Party shall not be required to obtain Debtors’ consent or
authorization for Secured Party to file, and Secured Party shall be entitled to
file, any financing statement, amendment, or other document that Secured Party
may be authorized to file in accordance with the terms of the UCC, including any
financing statement, amendment, or other document that Secured Party may be
authorized to file based on Debtors having executed this Agreement or based on
Debtors having executed any other security agreement.
 
 
3

--------------------------------------------------------------------------------

 
 
(c)           Any financing statement or other record filed to perfect the
security interests evidenced by this Agreement may, at Secured Party’s option,
describe or indicate the Collateral in the manner that the Collateral is
described in this Agreement, or as all assets of Debtors, or as all personal
property of Debtors, or by any other description or indication of the Collateral
that may be sufficient for a financing statement under the UCC.
 
2.03           Perfection by Possession.  If Collateral is of a type as to which
it is necessary, desirable, or advisable, as determined by Secured Party, for
Secured Party to take possession of such Collateral in order to protect,
perfect, or maintain the first priority of Secured Party’s security interest or
other lien in such (or any other) Collateral, then, promptly upon Secured
Party’s request from time to time and with respect to Collateral, each Debtor
shall deliver such Collateral to Secured Party.
 
2.04           Deposit Accounts.  (a)    Schedule 2.04 hereto accurately sets
forth, as of the date of this Agreement, each Deposit Account maintained by each
Debtor and the name of the respective bank with which such Deposit Account is
maintained.  For each Deposit Account Debtor shall cause the bank with which
such Deposit Account is maintained to execute and deliver to the Secured Party a
"control agreement" in form and substance satisfactory to the Secured Party.  If
any bank with which a Deposit Account is maintained refuses to, or for any other
reason does not, enter into such a "control agreement", then the Debtors shall
promptly (and in any event within 30 days of the date of this Agreement or, if
later, 30 days after the establishment of such account) close the respective
Deposit Account and transfer all balances therein to another Deposit Account
meeting the requirements of this Section 2.04.

(b)           After the date of this Agreement, Debtors shall not establish any
new demand, time, savings, passbook or similar account, except for Deposit
Accounts established and maintained with banks and meeting the requirements of
the preceding clause (a).  Within 30 days after any such Deposit Account is
established, the appropriate "control agreement" shall be entered into in
accordance with the requirements of preceding clause (a), and Debtors shall
furnish to the Secured Party a supplement to Schedule 2.04 hereto containing the
relevant information with respect to the respective Deposit Account and the bank
with which same is established.

2.05           Actions by Secured Party.  None of the following shall affect the
Obligations of Debtors to Secured Party under this Agreement or Secured Party's
rights with respect to the Collateral.

(a)           Acceptance or retention by Secured Party of other property or
interests in property as security for the Obligations;

(b)           Release of all or any part of the Collateral;
 
 
4

--------------------------------------------------------------------------------

 

(c)           Release, extension, renewal, modification or compromise of the
liability of any guarantor of the Obligations; or

(d)           Failure by Secured Party to resort to other security or pursue
Debtors or any other obligor liable for any of the Obligations before resorting
to the Collateral.

ARTICLE III
 
WARRANTIES AND COVENANTS
 
3.01           Debtor’s Name and Identification Number.  The name of each Debtor
set forth on the first page and the signature page of this Agreement is such
Debtor’s correct and complete legal name.  The street address for each Debtor in
this Agreement is such Debtor’s mailing address, and the facsimile number for
each Debtor set forth in this Agreement is such Debtor’s facsimile
number.  Debtors shall not change Debtors’ name or corporate structure or change
the location of Debtors’ chief executive office without at least thirty (30)
days’ prior written notice to Secured Party.
 
3.02           Organization, Power.  Each Debtor (a) is a corporation duly
organized, validly existing and in good standing under the laws of its state of
incorporation, (b) has the corporate power and authority to own such Debtor’s
properties and assets and to carry on such Debtor’s business as now conducted,
(c) has the corporate power and authority to execute, deliver and perform this
Agreement and the other Note Purchase Documents and each agreement or instrument
contemplated thereby to which such Debtor is or will be a party, and (d) is
qualified to do business in every jurisdiction where such qualification is
necessary except where the failure to so qualify would not have a materially
adverse effect on such Debtor’s business, properties, operations, prospects or
condition, financial or otherwise, and would not impair such Debtor’s ability to
perform such Debtor’s obligations under or in connection with the Note Purchase
Documents.
 
3.03           Ownership of Property; Priority of Security Interest.  Each
Debtor is the sole owner of the Collateral free from any lien, security interest
or encumbrance of any kind (other than Permitted Lien) and such Debtor will not
sell, lease or grant any further security interest in the Collateral or any part
thereof, and will not part with possession of the same, except in the usual and
ordinary course of such Debtor’s business or as otherwise permitted under the
Amended and Restated Purchase Agreement.  Debtors will not use or permit the
Collateral to be used in violation of any law or ordinance and Debtors will
procure and maintain, or cause to be procured and maintained, insurance on the
Collateral for the full duration of this Agreement against reasonable risks of
loss, damage and destruction in accordance with the provisions of the Amended
and Restated Purchase Agreement.
 
3.04           Location of Collateral.  The Collateral is located at the
locations listed on Exhibit A (the “Designated Locations”).  Each Debtor’s chief
executive office is located at the address listed on the first page of this
Agreement.
 
 
5

--------------------------------------------------------------------------------

 
 
3.05           Further Assurances.  Each Debtor shall, at Secured Party's
request, at any time and from time to time, deliver to Secured Party such
financing statements and execute and/or deliver such other documents and
instruments and do such acts as Secured Party may deem reasonably necessary or
desirable in order to establish and maintain valid, attached and perfected
security interests in the Collateral in favor of Secured Party, free and clear
of all liens, claims and rights of third parties whatsoever.  Each Debtor hereby
irrevocably appoints any officer of Secured Party (designated by Secured Party
for such purpose) its attorney-in-fact, in such Debtor's name, place and stead,
to execute such financing statements and other documents and, upon the
occurrence and during the continuation of an Event of Default, to do such other
acts as Secured Party may reasonably require to perfect and preserve Secured
Party's security interest in, and to enforce such interests in the Collateral,
hereby ratifying and confirming all that said attorney-in-fact may do or cause
to be done by virtue hereof.  If any of the Collateral includes any vehicles
with an aggregate market value in excess of $25,000 and having a certificate of
title, each Debtor shall deliver to Secured Party the original certificate of
title for each such vehicle or vehicles, together with such applications and
other documents which Secured Party may request in order to have Secured Party's
security interest noted on the certificate of title for such vehicle and to
otherwise perfect Secured Party's security interest therein.
 
3.06           Identity; Locations.  Debtors shall not change Debtors’ name or
corporate structure or change the location of Debtors’ chief executive office
without at least thirty (30) days’ prior written notice to the Secured Party.
 
3.07           Liens.  Debtors shall not create, incur, assume or suffer to
exist any liens or encumbrances upon the Collateral other than Permitted Liens.
 
3.08           Covenants under Amended and Restated Purchase Agreement.  As long
as any Secured Obligations are outstanding, each Debtor shall comply with the
covenants and agreements to which it or the Collateral are subject under the
terms of this Agreement and the Amended and Restated Purchase Agreement.
 
ARTICLE IV
 
EVENT OF DEFAULT; ENFORCEMENT OF SECURITY INTEREST
 
4.01           Rights and Remedies.  The occurrence of an "Event of Default"
under the Amended and Restated Purchase Agreement shall constitute an Event of
Default under this Agreement.  Upon the occurrence  and continuation of an Event
of Default under the Amended and Restated Purchase Agreement, Secured Party may
exercise, from time to time, any rights and remedies available to it under the
UCC and any other applicable law in addition to, and not in lieu of, any rights
and remedies expressly granted in this Agreement, the Amended and Restated
Purchase Agreement or in any other Note Purchase Documents and may, without
limitation, take possession of any or all of the Collateral (in addition to
Collateral of which it already has possession) without notice, demand or legal
process of any kind, wherever it may be found, and for that purpose may pursue
the same wherever it may be found, and may enter into each Debtor's premises
where any of the Collateral may be or be supposed to be, and search for, take
possession of, remove, keep and store any of the Collateral until the same shall
be sold or otherwise disposed of, and Secured Party shall have the right to
store the same at each Debtor's premises without cost to Secured Party.  At
Secured Party’s request, each Debtor will, at such Debtor’s expense, assemble
the Collateral and make it available to Secured Party at a place or places to be
designated by Secured Party which is reasonably convenient to Secured Party and
such Debtor.
 
 
6

--------------------------------------------------------------------------------

 
 
4.02           Disposition of Collateral.
 
(a)           Upon the occurrence and continuation of an Event of Default under
the Amended and Restated Purchase Agreement, Secured Party may sell, lease,
license, or otherwise dispose of any or all of the Collateral in its present
condition or following any commercially reasonable preparation or
processing.  Each Debtor agrees that 10 days notice from Secured Party of any
proposed sale or other disposition of Collateral by Secured Party shall be
reasonable.
 
(b)           Upon the occurrence and continuation of an Event of Default under
the Amended and Restated Purchase Agreement, Secured Party may dispose of
Collateral by public or private proceedings, by one or more contracts, as a unit
or in parcels, and at any time and place and on any terms.
 
(c)           Upon the occurrence and continuation of an Event of Default under
the Amended and Restated Purchase Agreement, Secured Party may purchase
Collateral (1) at a public disposition or (2) if the Collateral is of a kind
that is customarily sold on a recognized market or the subject of widely
distributed standard price quotations, at a private disposition at standard
market prices for such Collateral.
 
4.03           Power of Attorney.  Each Debtor hereby appoints Secured Party as
such Debtor’s attorney-in-fact, with power of substitution, which appointment is
irrevocable and coupled with an interest, to do each of the following in the
name of such Debtor or in the name of Secured Party or otherwise, for the use
and benefit of Secured Party, but at the cost and expense of  such Debtor, and
with or without notice to such Debtor upon the occurrence and during the
continuation of an Event of Default under the Amended and Restated Purchase
Agreement in accordance with the terms thereof, to endorse such Debtor's name to
checks, drafts, instruments and other items of payment, and/or proceeds of the
Collateral.  The foregoing power of attorney is in addition to any other power
of attorney that may be granted to Secured Party under any Note Purchase
Document.
 
ARTICLE V
 
GENERAL PROVISIONS
 
5.01           Remedies Cumulative.  No failure or delay on the part of Secured
Party in exercising any right, power or privilege hereunder or under any other
Note Purchase Document and no course of dealing between Debtors, Debtors or
other Person and Secured Party shall operate as a waiver thereof; nor shall any
single or partial exercise of any right, power or privilege hereunder or under
any other Note Purchase Document preclude any other or further exercise thereof
or the exercise of any other right, power or privilege hereunder or
thereunder.  The rights and remedies provided in this Agreement are cumulative
and not exclusive of any rights or remedies which Secured Party would otherwise
have and may be exercised simultaneously.  No notice to or demand on Debtors in
any case shall entitle Debtors, Debtors or any other Person to any other or
further notice or demand in similar or other circumstances or constitute a
waiver of the rights of Secured Party to any other or further action in any
circumstances without notice or demand.  EACH DEBTOR WAIVES EVERY DEFENSE, CAUSE
OF ACTION, COUNTERCLAIM OR SETOFF WHICH SUCH DEBTOR MAY NOW HAVE OR HEREAFTER
MAY HAVE TO ANY ACTION BY SECURED PARTY IN ENFORCING THIS AGREEMENT OR THE
COLLATERAL AND RATIFIES AND CONFIRMS WHATEVER SECURED PARTY MAY DO PURSUANT TO
THE TERMS HEREOF AND WITH RESPECT TO THE COLLATERAL AND AGREES THAT SECURED
PARTY SHALL NOT BE LIABLE FOR ANY ERROR OF JUDGMENT OR MISTAKES OF FACT OR LAW.
 
 
7

--------------------------------------------------------------------------------

 
 
5.02           Notices.  All notices, demands or other communications to be
given or delivered under or by reason of the provisions of this Agreement shall
be in writing and shall be deemed to have been given (i) when delivered
personally to the recipient, (ii) sent to the recipient by reputable overnight
courier service (charges prepaid), (iii) mailed to the recipient by certified or
registered mail, return receipt requested and postage prepaid or (iv) sent via
facsimile or electronic transmission, in each case upon telephone or further
electronic communication from the recipient acknowledging receipt (whether
automatic or manual from recipient), as applicable.  Such notices, demands and
other communications shall be sent to Secured Party and Debtors at the address
indicated below:
 

To Debtors: Aemetis Advanced Fuels Keyes, Inc.
20400 Stevens Creek Boulevard, Suite 700
Cupertino, California 95014
Attention: Eric A. McAfee - President
    To Secured Party:
Third Eye Capital Corporation
Brookfield Place, TD Canada Trust Tower
161 Bay Street, Suite 3820
Toronto, Ontario ON M5J 2S1
Canada
Attention: Mr. Arif N. Bhalwani, Managing Director
    With a copy to: DLA Piper LLP (US)
500 8th Street, NW
Washington, DC 20004
Attention: Eric Eisenberg

 
 
8

--------------------------------------------------------------------------------

 
 
5.03           Term.  The term of this Agreement shall commence with the date of
this Agreement and shall continue in full force and effect and be binding upon
each Debtor until all Secured Obligations shall have been fully paid and
satisfied and Secured Party shall have given Debtors written notice of the
termination of this Agreement (excluding provisions that by their terms survive
termination of other provisions of this Agreement or survive the termination of
the security interest created under this Agreement). Secured Party shall not be
obligated to give Debtors written notice of termination of this Agreement, or to
terminate any financing statements or other liens, until all Secured Obligations
shall have been fully paid and satisfied and there is no commitment on the part
of Secured Party or any purchaser to make an advance, incur an obligation or
otherwise give value, and Debtors shall have given Secured Party a written
demand requesting the termination of this Agreement and any financing statements
at which time Secured Party shall execute and deliver such documents, at
Debtors’ expense, as are necessary to release Secured Party’s liens in the
Collateral.  Notwithstanding anything to the contrary in this Agreement or any
other Note Purchase Documents, this Agreement shall continue to be effective or
be reinstated, as the case may be, if at any time any amount received by Secured
Party in respect of the Secured Obligations is rescinded or must otherwise be
restored or returned by Secured Party upon the insolvency, bankruptcy,
dissolution, liquidation or reorganization of Debtors or upon the appointment of
any intervenor or conservator of, or trustee or similar official for, Debtors or
any substantial part of Debtors’ assets, or otherwise, all as though such
payments had not been made.
 
5.04           Further Assurances.  Each Debtor shall execute and deliver to
Secured Party such further assurances and take such other further actions as
Secured Party may from time to time reasonably request to further the intent and
purpose of this Agreement and the other Note Purchase Documents and to maintain
and protect the rights and remedies intended to be created in favor of Secured
Party under this Agreement and the other Note Purchase Documents.
 
5.05           Amendments, Waivers and Consents;  Successors and Assigns.  This
Agreement may not be amended, modified, changed, waived, discharged or
terminated, nor shall any consent be given, unless such amendment, modification,
change, waiver, discharge, termination or consent is in writing signed by
Secured Party and Debtors.  This Agreement shall create a continuing security
interest in the Collateral and shall (i) remain in full force and effect until
the Secured Obligations have been fully paid and satisfied and this Agreement
has been terminated, (ii) be binding upon each Debtor and each Debtor’s
successors and assigns, and (iii) inure, together with the rights and remedies
of Secured Party hereunder, to the benefit of Secured Party and Secured Party’s
successors, transferees and assigns.  This Agreement may not be assigned by
Debtors without the prior written consent of Secured Party.
 
5.06           Entire Agreement.  This Agreement is the complete and exclusive
expression of all the terms of the matters expressed herein, and all prior
agreements, statements, and representations, whether written or oral, which
relate hereto in any way are hereby superseded and shall be given no force and
effect.  No promise, inducement, or representation has been made to Debtors
which relates in any way to the matters expressed in this Agreement and in any
other Note Purchase Documents with this Agreement, other than what is expressly
stated herein and in such Note Purchase Documents.
 
5.07           Amendment and Restatement.  This Agreement amends and restates in
its entirety the Original Security Agreement. This Agreement shall not be deemed
to constitute a novation of the Original Security Agreement or the obligations
evidenced thereby.
 
 
9

--------------------------------------------------------------------------------

 
 
5.08           No Strict Construction.  The parties hereto have participated
jointly in the negotiation and drafting of this Agreement.  In the event of any
ambiguity or question of intent or interpretation arises, this Agreement shall
be construed as if drafted jointly by the parties hereto and no presumption or
burden of proof shall arise favoring or disfavoring any party by virtue of the
authorship of any provisions of this Agreement.
 
5.09           Indemnification.  In addition to and not in limitation of any
indemnification obligations of Debtors under the Amended and Restated Purchase
Agreement, each Debtor agrees to indemnify the Secured Party from and against
any and all claims, losses and liabilities arising out of or resulting from this
Agreement (including, without limitation, enforcement of this Agreement),
including without limitation any past, present or future violation of any
Environmental Laws, relating to or affecting such Debtor’s properties or such
Debtor’s operations, whether or not caused by or within the control of such
Debtor, except claims, losses or liabilities resulting from the gross negligence
or willful misconduct of the Secured Party.
 
5.10           Governing Law.  This Agreement and all related instruments and
documents and the rights and obligations of the parties hereunder and thereunder
shall, in all respects, be governed by, and construed in accordance with, the
internal laws of the State of Delaware, without regard to conflict of laws
principles thereof that would require the application of the laws of a
jurisdiction other than Delaware.
 
5.11           JURISDICTION; VENUE.  Debtor submits to the jurisdiction of any
state or Federal court sitting in the State of Delaware in any legal suit,
action or proceeding arising out of or relating to this Agreement, (ii) agrees
that all claims in respect of the action or proceeding may be heard or
determined in any such court and (iii) agrees not to bring any action or
proceeding arising out of or relating to this Agreement in any other
court.  Each of the parties waives any defense of inconvenient forum to the
maintenance of any action or proceeding so brought and waives any bond, surety
or other security that might be required of any other party with respect
thereto.  Any party may make service on any other party by sending or delivering
a copy of the process to the party to be served at the address and in the manner
provided for the giving of notices in Section 5.02.  Each party agrees that a
final judgment in any action or proceeding so brought shall be conclusive and
may be enforced by suit on the judgment or in any other manner provided by
law.  Nothing herein shall affect the right to serve process in any other manner
permitted by law or shall limit the right of the Secured Party to bring
proceedings against Debtors in the courts of any other jurisdiction.  To the
extent provided by law, should Debtors, after being so served, fail to appear or
answer to any summons, complaint, process or papers so served within the number
of days prescribed by law after the mailing thereof, Debtors shall be deemed in
default and an order and/or judgment may be entered by the court against Debtors
as demanded or prayed for in such summons, complaint, process or papers.  The
exclusive choice of forum for Debtors set forth in this Section 5.11 shall not
be deemed to preclude the enforcement by Secured Party of any judgment obtained
in any other forum or the taking by the Secured Party of any action to enforce
the same in any other appropriate jurisdiction, and Debtors hereby waive the
right to collaterally attack any such judgment or action.
 
 
10

--------------------------------------------------------------------------------

 
 
5.12           Severability.  Any provision of this Agreement, or of any other
Note Purchase Document, that is prohibited by, or unenforceable under, the laws
of any jurisdiction shall, as to such jurisdiction, be ineffective to the extent
of such prohibition or unenforceability, without invalidating the remaining
provisions of this Agreement, and any such prohibition or unenforceability in
any jurisdiction shall not invalidate or render unenforceable such provision in
any other jurisdiction.
 
5.13           Counterparts.  This Agreement may be executed in counterparts and
each shall be effective as an original, and a photocopy, facsimile or telecopy
of this executed Agreement shall be effective as an original.  In making proof
of this Agreement, it shall not be necessary to produce more than one
counterpart, photocopy, facsimile, or telecopy of this Agreement.
 
5.14           Miscellaneous.  Terms used in this Agreement shall be applicable
to the singular and plural, and references to gender shall include all genders.
 
5.15           WAIVER OF JURY TRIAL.  DEBTORS AND SECURED PARTY MUTUALLY WAIVE
ALL RIGHT TO TRIAL BY JURY OF ALL CLAIMS OF ANY KIND ARISING UNDER THIS
AGREEMENT OR THE OTHER NOTE PURCHASE DOCUMENTS.  DEBTORS AND SECURED PARTY
ACKNOWLEDGE THAT THIS IS A WAIVER OF A LEGAL RIGHT AND THAT EACH DEBTOR AND
SECURED PARTY EACH MAKE THIS WAIVER VOLUNTARILY AND KNOWINGLY AFTER CONSULTATION
WITH COUNSEL OF ITS CHOICE.  DEBTORS AND SECURED PARTY AGREE THAT ALL SUCH
CLAIMS SHALL BE TRIED BEFORE A JUDGE OF A COURT HAVING JURISDICTION, WITHOUT A
JURY.
 
[SIGNATURE PAGE FOLLOWS]
 
 
11

--------------------------------------------------------------------------------

 
 
EXECUTION COPY

IN WITNESS WHEREOF, and intending to be legally bound hereby, Debtors and
Secured Party execute this Agreement as of the date first above written.
 

   
DEBTORS:
         
AEMETIS, INC.
AEMETIS ADVANCED FUELS KEYES, INC.
AEMETIS BIOCHEMICALS INC.
AEMETIS INTERNATIONAL, INC.
AEMETIS TECHNOLOGIES, INC.
AEMETIS BIOFUELS, INC.
AE ADVANCED FUELS, INC.
AEMETIS ADVANCED FUELS, INC.
AEMETIS AMERICAS, INC.
ENERGY ENZYMES, INC.
AE BIOFUELS, INC.
 
By:  /s/ Eric A. McAfee                                              
                                                             
Name: Eric A. McAfee
Title: Chief Executive Officer
 
 
   
BIOFUELS MARKETING, INC.
 
By:  /s/ Eric A. McAfee                                              
                                                             
Name: Eric A. McAfee
Title:  President
 
   
KEYES FACILITY ACQUISITION CORP., predecessor in interest to Cilion, Inc.
pursuant to the Acquisition and to be known as Aemetis Facility Keyes, Inc.
after the consummation of the Acquisition
 
By:  /s/ Eric A. McAfee                                              
                                                             
Name: Eric A. McAfee
Title: Chief Executive Officer

signature page to amended and restated security agreement – Borrower and
affiliates
 
 
12

--------------------------------------------------------------------------------

 
 
 

   
SECURED PARTY:
 
THIRD EYE CAPITAL CORPORATION
 
By:  /s/ David G. Alexander                                      
                                                             
Name:  David G.
Alexander                                                        
Title:  Managing
Director                                                        

signature page to amended and restated security agreement – Borrower AND
AFFILIATES
 
 
13

--------------------------------------------------------------------------------