Fix NPE, improve importer