Fixed bugs in generator and export/import