fix bug in prepare_import