improve robustness of import_flatfile_into_database