notify_exn exc;
               unlock_world ()
        in
-        worker_thread := Some (Thread.create thread_main ()) in
+       thread_main ();
+        (* worker_thread := Some (Thread.create thread_main ()) *)
+      in
       let kill_worker =
        (* the following lines are from Xavier Leroy: http://alan.petitepomme.net/cwn/2005.11.08.html *)
        let interrupt = ref None in
         | None -> true
         | Some path -> 
             let is_prefix_of d1 d2 =
+              let d1 = MatitamakeLib.normalize_path d1 in
+              let d2 = MatitamakeLib.normalize_path d2 in
               let len1 = String.length d1 in
               let len2 = String.length d2 in
               if len2 < len1 then 
 
 let pool () = Helm_registry.get "matita.basedir" ^ "/matitamake/" ;;
 let rootfile = "/root" ;;
 
+(* /foo/./bar/..//baz -> /foo/baz *)
+let normalize_path s = 
+  let s = Str.global_replace (Str.regexp "//") "/" s in
+  let l = Str.split (Str.regexp "/") s in
+  let rec aux = function
+    | [] -> []
+    | he::".."::tl -> aux tl
+    | he::"."::tl -> aux (he::tl)
+    | he::tl -> he :: aux tl
+  in
+  (if Str.string_match (Str.regexp "^/") s 0 then "/" else "") ^
+  String.concat "/" (aux l)
+  ^ (if Str.string_match (Str.regexp "/$") s 0 then "/" else "")
+;;
+
 let ls_dir dir = 
   try
     let d = Unix.opendir dir in
 
 (* given a dir finds a development that is radicated in it or below *)
 let development_for_dir dir =
+  let dir = normalize_path dir in
   let is_prefix_of d1 d2 =
     let len1 = String.length d1 in
     let len2 = String.length d2 in
   
 (* creates a new development if possible *)
 let initialize_development name dir =
+  let dir = normalize_path dir in
   let name = Pcre.replace ~pat:" " ~templ:"_" name in 
   let dev = {name = name ; root = dir} in
   dump_development dev;