Fix for issue #9.

This should work both for saving it as a script or bundle as an app.