Improved the agn_import_canonical function