Fix for crash when importing a second time during the same session.

The cause were global variables which weren't properly initialized.