diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index 8e86c417f9864b838b21a1d9626d6116227b80e3..6f1b9aaf87c64924fa5355059a8bb44b5307b970 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -672,12 +672,6 @@ void cluster(string config_file, string data_file, string output_path) {
     }
     fclose(output);
     // Clean memory
-    delete c1;
-    delete c1ao;
-    delete c3;
-    delete c4;
-    delete c6;
-    delete c9;
     for (int zi = c4->lm - 1; zi > -1; zi--) {
       for (int zj = 2; zj > -1; zj--) {
 	delete[] zpv[zi][zj][1];
@@ -687,6 +681,12 @@ void cluster(string config_file, string data_file, string output_path) {
       delete[] zpv[zi];
     }
     delete[] zpv;
+    delete c1;
+    delete c1ao;
+    delete c3;
+    delete c4;
+    delete c6;
+    delete c9;
     delete[] am_vector;
     delete[] am;
     //delete[] tam;