Index: tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/tester/TIGERSearchTester.java
===================================================================
--- tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/tester/TIGERSearchTester.java	(revision 1189)
+++ tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/tester/TIGERSearchTester.java	(revision 1190)
@@ -41,7 +41,8 @@
 					return false;
 				}
 				MainCorpus corpus = (MainCorpus) receiver;
-
+				if (corpus.getProjectDirectory() == null) return false;
+				
 				return new File(corpus.getProjectDirectory(), "tiger").exists();
 			}
 		}
Index: tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 1189)
+++ tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java	(revision 1190)
@@ -12,6 +12,8 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.Toolbox;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.CorpusBuild;
 import org.txm.objects.Project;
 import org.txm.stat.utils.LogMonitor;
 import org.txm.utils.DeleteDir;
@@ -67,6 +69,7 @@
 
 	public void init(Project p) {
 		this.project = p;
+		
 		corpusName = project.getName();
 		//this.debug = "true".equals(project.getKeyValueParameters().get(ImportKeys.DEBUG));
 		
@@ -84,15 +87,12 @@
 			File txmDir = new File(binaryDirectory, "txm");
 			//DeleteDir.deleteDirectory(binaryDirectory);
 			try {
-				IPath path = p.getRCPProject().getFullPath();
-				for (IResource r : p.getRCPProject().members()) {
-					if (r.isHidden()) continue;
-					r.delete(true, new LogMonitor("XTZ delete project content"));
-				}
-//				p.getRCPProject().getFolder("txm").delete(true, );
-//				p.getRCPProject().getFolder("data").delete(true, new LogMonitor("XTZ delete project content"));
-//				p.getRCPProject().getFolder("HTML").delete(true, new LogMonitor("XTZ delete project content"));
-				
+				p.getRCPProject().getFolder("HTML").delete(true, new LogMonitor("XTZ delete project content"));
+				p.getRCPProject().getFolder("cqp").delete(true, new LogMonitor("XTZ delete project content"));
+				p.getRCPProject().getFolder("data").delete(true, new LogMonitor("XTZ delete project content"));
+				p.getRCPProject().getFolder("registry").delete(true, new LogMonitor("XTZ delete project content"));
+				p.getRCPProject().getFolder("tokenized").delete(true, new LogMonitor("XTZ delete project content"));
+				p.getRCPProject().getFolder("txm").delete(true, new LogMonitor("XTZ delete project content"));
 			} catch (CoreException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 1189)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 1190)
@@ -1169,39 +1169,33 @@
 	 * Deletes all non persistent results and saves the results to persist.
 	 */
 	public static void deleteAllNonPersistentResults() {
-		File logs = new File(System.getProperty("user.home"), "logs.txt");
-		PrintWriter w = null;
+//		File logs = new File(System.getProperty("user.home"), "logs.txt");
+//		PrintWriter w = null;
 		try {
-			w = IOUtils.getWriter(logs);
+//			w = IOUtils.getWriter(logs);
 			List<TXMResult> todo = Toolbox.workspace.getChildren();
 			while (todo.size() > 0) {
 				TXMResult r = null;
-				try {
+//				try {
 					r = todo.remove(0);
 					todo.addAll(0, r.getChildren());
-					w.println("Persisting? "+r);
+//					w.println("Persisting? "+r);
 					if (r.mustBePersisted())	{ 
-						w.println(" YES");
+//						w.println(" YES");
 						TXMPreferences.flush(r);
 					}
 					else {
-						w.println(" NO");
+//						w.println(" NO");
 						Log.finest("TXMResult.deleteAllNonPersistentResults(): Deleting result " + r.getSimpleName() + " of type " + r.getClass().getSimpleName() + ".");
 						TXMPreferences.delete(r);
 					}
-				} catch (Exception e) {
-					w.println(" Error: "+e+" with "+r);
-				}
-				w.println(" OK: "+r);
+//				} catch (Exception e) {
+//					w.println(" Error: "+e+" with "+r);
+//				}
+//				w.println(" OK: "+r);
 			}
-		} catch (UnsupportedEncodingException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		} catch (FileNotFoundException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
 		} finally {
-			if (w != null) w.close();
+//			if (w != null) w.close();
 		}
 	}
 
@@ -1460,7 +1454,7 @@
 	 * @param type
 	 * @return
 	 */
-	protected static List<TXMResult> getNodes(List<TXMResult> srcNodes, Class type, boolean onlyVisible) {
+	protected static List<TXMResult> getNodes(List<TXMResult> srcNodes, Class<? extends TXMResult> type, boolean onlyVisible) {
 		List<TXMResult> nodes = new ArrayList<TXMResult>();
 		for (TXMResult child : srcNodes) {
 			try {
Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1189)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1190)
@@ -301,12 +301,19 @@
 				return true;
 			}
 	
-			if (monitor == null) {
+			if (monitor == null || monitor.isCanceled()) {
 				monitor = new LogMonitor("computing "+this);
 			}
 	
 			Log.finest("RUNNING IMPORT MODULE WITH NAME = " + getImportModuleName());
 			
+			// This step could be done only if the compiler step if done and only if it modifying/deleteing the corpus builds
+			for (CorpusBuild corpus : getCorpusBuilds()) {
+				if (corpus != null) {
+					corpus.deleteChildren(null); // remove all Corpus results
+				}
+			}
+			
 			boolean state = engine.build(this, monitor).isOK();
 			if(state == true)	{
 				this.needToBuild = false;
@@ -330,7 +337,8 @@
 	private void initRCPStuffs() throws CoreException {
 		IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
 		if (this.rcpProject == null) {
-			this.rcpProject = rcpWorkspace.getRoot().getProject(this.getName());
+			String n = this.getName();
+			this.rcpProject = rcpWorkspace.getRoot().getProject(n);
 		}
 
 		if (!rcpProject.exists()) {
@@ -1222,8 +1230,12 @@
 	// FIXME: SJ: need to see if we need this, it doesn't seem.
 	public boolean save() {
 		try {
+			ProjectScope scope = this.getPreferencesScope();
+			scope.getNode("").flush();
+			
 			autoSaveParametersFromAnnotations();
 			saveParameters();
+			
 			List<TXMResult> results = this.getDeepChildren();
 			for (int i = 0; i < results.size(); i++) {
 				TXMResult r = results.get(i);
Index: tmp/org.txm.setups/shared/debian/DEBIAN/preinst
===================================================================
--- tmp/org.txm.setups/shared/debian/DEBIAN/preinst	(revision 1189)
+++ tmp/org.txm.setups/shared/debian/DEBIAN/preinst	(revision 1190)
@@ -1,27 +1,33 @@
 #!/bin/bash
 VERSION=-TXMVERSION
 
+echo "removing /usr/lib/TXM${VERSION}"
 if [ ! -d "/usr/lib/TXM${VERSION}" ]; then
 	rm -rf "/usr/lib/TXM${VERSION}"
 fi
 
+echo "removing /usr/share/doc/txm${VERSION}"
 if [ ! -d "/usr/share/doc/txm${VERSION}" ]; then
 	rm -rf "/usr/share/doc/txm${VERSION}"
 fi
 
+echo "removing /usr/share/lintian/overrides/txm${VERSION}"
 if [ ! -d "/usr/share/lintian/overrides/txm${VERSION}" ]; then
 	rm -rf "/usr/share/lintian/overrides/txm${VERSION}"
 fi
 
+echo "removing /usr/share/TXM${VERSION}"
 if [ ! -d "/usr/share/TXM${VERSION}" ]; then
 	rm -rf "/usr/share/TXM${VERSION}"
 fi
 
+echo "removing /usr/share/applications/TXM${VERSION}.desktop"
 if [ ! -f "/usr/share/applications/TXM${VERSION}.desktop" ]; then
 	rm "/usr/share/applications/TXM${VERSION}.desktop"
 	rm "/usr/share/applications/TXM${VERSION} debug.desktop"
 fi
 
+echo "removing /usr/bin/TXM${VERSION}"
 if [ ! -f "/usr/bin/TXM${VERSION}" ]; then
 	rm "/usr/bin/TXM${VERSION}"
 fi
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 1189)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java	(revision 1190)
@@ -41,6 +41,7 @@
 			return null;
 		}
 		project.setDirty();
+		project.setNeedToBuild();
 		project.setDoMultiThread(false); //too soon
 		project.setDoUpdate(true);
 		
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 1189)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java	(revision 1190)
@@ -42,7 +42,8 @@
 	 * @param toolkit2
 	 * @param form2
 	 * @param parent
-	 * @param style
+	 * @param stylesave
+	 * 
 	 * @param moduleParams
 	 * @param scriptName temporary parameter to detect if import module is xtzLoader.groovy
 	 */
@@ -270,9 +271,9 @@
 
 				build = buildFacsEditionCheckButton.getSelection();
 
-				edition_params = project.getEditionDefinition("facs");
-				edition_params.setBuildEdition(build);
-				edition_params.setImagesDirectory(images_directory);
+				EditionDefinition edition_params2 = project.getEditionDefinition("facs");
+				edition_params2.setBuildEdition(build);
+				edition_params2.setImagesDirectory(images_directory);
 			}
 		}
 		return true;
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 1189)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java	(revision 1190)
@@ -974,7 +974,7 @@
 
 		if (successfulSave) {
 			try {
-				project.saveParameters();
+				project.save();
 				//				DomUtils.save(params.root.getOwnerDocument(), paramFile);
 			} catch (Exception e1) {
 				org.txm.rcp.utils.Logger.printStackTrace(e1);
Index: tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java
===================================================================
--- tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 1189)
+++ tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 1190)
@@ -49,6 +49,7 @@
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
 import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.MemCqiClient;
 import org.txm.searchengine.cqp.Reference;
 import org.txm.searchengine.cqp.ReferencePattern;
@@ -387,7 +388,7 @@
 	@Override
 	public void clean() {
 		try {
-			if (queryResult != null)	{
+			if (queryResult != null && CQPSearchEngine.isInitialized())	{
 				queryResult.drop();
 			}
 		} catch (Exception e) {
