Fix export bug and event handling bug.
Normalize file. No trailing whitespace at EOL.