diff --git a/bluepymm/prepare_combos/prepare_emodel_dirs.py b/bluepymm/prepare_combos/prepare_emodel_dirs.py
index 4602f15898db081cdc72104cd3d346497200b5ae..60a4651fd8d892bc73bc1ed60121354bb037840b 100644
--- a/bluepymm/prepare_combos/prepare_emodel_dirs.py
+++ b/bluepymm/prepare_combos/prepare_emodel_dirs.py
@@ -90,6 +90,9 @@ def convert_emodel_input(emodels_in_repo, conf_dict, continu):
             with tools.cd(tmp_emodels_dir):
                 sh.git('checkout', conf_dict['emodels_githash'])
         else:
+            if (os.path.exists(tmp_emodels_dir)
+               and os.path.isdir(tmp_emodels_dir)):
+                shutil.rmtree(tmp_emodels_dir)
             shutil.copytree(conf_dict['emodels_dir'], tmp_emodels_dir)
     return tmp_emodels_dir
 
diff --git a/tests/test_prepare_emodel_dirs.py b/tests/test_prepare_emodel_dirs.py
index fedb4f7c425590a9cb286451b8a9d1b3784975c5..b9870d77801f84cd823d146b81fbcbfd9814c8c4 100644
--- a/tests/test_prepare_emodel_dirs.py
+++ b/tests/test_prepare_emodel_dirs.py
@@ -82,7 +82,10 @@ def test_convert_emodel_input_dir():
     continu = False
     _test_convert_emodel_input(TEST_DATA_DIR, emodels_in_repo, conf_dict,
                                continu)
-
+    # the second run is to make sure that the tmp_dir gets deleted and recopied
+    # in the consecutive runs
+    _test_convert_emodel_input(TEST_DATA_DIR, emodels_in_repo, conf_dict,
+                               continu)
 
 # TODO : how to do the test below?
 # @pytest.mark.unit