diff --git a/src/TODO b/src/TODO
index 5a9344069bafdec18d93aeb8ff8568755f067887..4f416b8befa6d9e752cd80d63fff8d0418e204c9 100644
--- a/src/TODO
+++ b/src/TODO
@@ -99,6 +99,8 @@ ou faire en sorte que lus2lic invente un noeud alias interm
 *********************************************************************
 *** questions pour bibi
 
+* EvalClock.var_clock_to_base (l200): c'est pas ca qu'il faut faire. 
+  en effet, si on 1+1+a when c, ca risque de ne pas marcher.
 
 * Faire qque chose pour les 2 verrues dans predefSemantics
   pas facile...
diff --git a/src/evalClock.ml b/src/evalClock.ml
index 9dd9ef592bb5f8138bb0afe5cee79c2c6f77ff9b..5bccfbe0bcdf61f4ad88bceb780739bbd5d7daec 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 19/08/2008 (at 15:55) by Erwan Jahier> *)
+(** Time-stamp: <modified the 19/08/2008 (at 16:33) by Erwan Jahier> *)
  
   
 open Predef
@@ -229,8 +229,9 @@ let rec (f : id_solver -> subst -> val_exp_eff -> clock_eff list * subst) =
          may remain. *)
       Hashtbl.iter 
         (fun ve cel -> 
-           let cel = List.map (apply_subst s) cel in
-             Hashtbl.replace val_exp_eff_clk_tab ve cel)
+           let cel2 = List.map (apply_subst2 s) cel in
+             if cel <> cel2 then
+               Hashtbl.replace val_exp_eff_clk_tab ve cel)
         val_exp_eff_clk_tab;
       res
 
diff --git a/src/test/should_work/clock/clock2.lus b/src/test/should_work/clock/clock2.lus
new file mode 100644
index 0000000000000000000000000000000000000000..d92d6e2e78ec2a386706f3634010f7515b25e53b
--- /dev/null
+++ b/src/test/should_work/clock/clock2.lus
@@ -0,0 +1,10 @@
+
+
+node clock(a: int; b: int) returns (c: int when a);
+-- var
+--  z: bool;
+
+let 
+  c = 1 + 1 + b when a;
+
+tel
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index af0f8e85ad9c5777246476961a376d657d61bf13..13f90f27e99bf8b4e2c9963a83bf12bf24890f8b 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -2281,7 +2281,7 @@ var
    v5:bool when v4;
    v6:bool when v5;
    v7:bool when v6;
-   _v1:bool when b;
+   _v1:bool when in;
    _v2:bool;
    _v3:bool;
    _v12:A_bool_7;
@@ -2289,9 +2289,9 @@ var
    _v5:bool;
    _v6:bool;
    _v8:bool;
-   _v7:bool when v1;
+   _v7:bool when v4;
    _v11:bool;
-   _v10:bool when v1;
+   _v10:bool when v4;
    _v9:bool when v5;
 let
    v1 = (clock::inOnIn(in, _v1));
@@ -9672,9 +9672,9 @@ var
    z2:bool;
    x:bool when z;
    e:bool when a;
-   _v1:bool when clock4_u;
-   _v2:bool when x;
-   _v3:bool when y;
+   _v1:bool when a;
+   _v2:bool when a;
+   _v3:bool when e;
 let
    (z, x) = (clock::clock3(z));
    e = (b when a);
@@ -9693,6 +9693,20 @@ returns (
 	clock2_y:bool);
 -- automatically defined aliases:
 type A_bool_10 = bool^10;
+----------------------------------------------------------------------
+====> ../lus2lic -vl 2 --compile-all-items should_work/clock/clock2.lus
+Opening file should_work/clock/clock2.lus
+node clock2::clock(a:int; b:int) returns (c:int when a);
+var
+   _v1:int;
+   _v2:int when a;
+let
+   c = (_v1 + _v2);
+   _v1 = (1 + 1);
+   _v2 = (b when a);
+tel
+-- end of node clock2::clock
+
 ----------------------------------------------------------------------
 ====> ../lus2lic -vl 2 --compile-all-items should_work/clock/clock_ite.lus
 Opening file should_work/clock/clock_ite.lus
@@ -9739,7 +9753,7 @@ returns (
 	clock4_x:bool;
 	clock4_y:bool when clock4_x);
 
-*** oops: an internal error occurred in file evalClock.ml, line 274, column 31
+*** oops: an internal error occurred in file evalClock.ml, line 275, column 31
 *** when compiling lustre program should_work/clock/when_not.lus
 
 ----------------------------------------------------------------------
@@ -10430,9 +10444,9 @@ var
    x:bool when z;
    y:bool when x;
    _v2:bool;
-   _v1:bool when u;
+   _v1:bool when a;
    _v3:bool;
-   _v4:bool when u;
+   _v4:bool when a;
 let
    y = (_v2 when x);
    _v2 = (clock::clock2(a, _v1));
diff --git a/src/unifyClock.ml b/src/unifyClock.ml
index 9acb2caa7dbc93541e189f7b3148937dc9ad39a2..75865aea737e1198ae83f88b324bba2cc043eec6 100644
--- a/src/unifyClock.ml
+++ b/src/unifyClock.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 19/08/2008 (at 09:26) by Erwan Jahier> *)
+(** Time-stamp: <modified the 19/08/2008 (at 16:32) by Erwan Jahier> *)
 
 
 open SyntaxTree
@@ -52,6 +52,16 @@ let rec (apply_subst:subst -> clock_eff -> clock_eff) =
       | ClockVar i -> 
 	  try apply_subst (s1,s2) (List.assoc i s2) 
 	  with Not_found -> c 
+
+(* only apply the part of the subst that deals with clock var *)
+let rec (apply_subst2:subst -> clock_eff -> clock_eff) =
+  fun (s1,s2) c -> 
+    match c with
+      | BaseEff -> BaseEff 
+      | On(v,clk) -> On(v, apply_subst (s1,s2) clk)
+      | ClockVar i -> 
+	  try apply_subst (s1,s2) (List.assoc i s2) 
+	  with Not_found -> c 
 	    
 (* exported *)
 let (f : Lxm.t -> subst -> clock_eff -> clock_eff -> subst) =
diff --git a/src/unifyClock.mli b/src/unifyClock.mli
index 3addba177f7ce354886566c1e7a563bc9d4ebb16..330a7b4d2a3c5f9508df58702e1d36ceb1b89ff5 100644
--- a/src/unifyClock.mli
+++ b/src/unifyClock.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/06/2008 (at 10:41) by Erwan Jahier> *)
+(** Time-stamp: <modified the 19/08/2008 (at 16:41) by Erwan Jahier> *)
 
 open CompiledData
 
@@ -32,6 +32,9 @@ val empty_subst : subst
 
 val apply_subst:subst -> clock_eff -> clock_eff
 
+(* only apply the part of the subst that deals with clock var *)
+val apply_subst2:subst -> clock_eff -> clock_eff
+
 (** Raises an error is the 2 clock_eff are not unifiable *)
 val f : Lxm.t -> subst -> clock_eff -> clock_eff -> subst
 val list : Lxm.t -> clock_eff list -> subst -> clock_eff * subst