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

The cause were global variables which weren't properly initialized.

In the end this was easier fixed, than I thought. It's not the ideal way to do it, but it beats rewriting the whole thing.

With this we should have a 1.0 version of the importer.