Fixes to import and export functionality.

Prevents possible crash with error files.Should allow for further testing of import/export.