diff --git a/tracking/rf.py b/tracking/rf.py
index dd064e52a64970cc085f97b4554efbafd92178cb..8f7998d7eabab0775f5d8dcdf0bfb788f651665f 100644
--- a/tracking/rf.py
+++ b/tracking/rf.py
@@ -181,12 +181,13 @@ class CavityResonator():
 
         """
         
-        # Number of the tracked bunch in this processor
-        self.bunch_index = beam.mpi.bunch_num
-        
+        if beam.mpi_switch:
+            self.bunch_index = beam.mpi.bunch_num # Number of the tracked bunch in this processor
+            
         self.distance = beam.distance_between_bunches
         self.valid_bunch_index = np.where(beam.filling_pattern == True)[0]
         self.tracking = True
+        self.nturn = 0
     
     def track(self, beam, ref_frame="beam"):
         """version type mbtrack + formule analytique"""
@@ -198,33 +199,41 @@ class CavityResonator():
             
             index = self.valid_bunch_index[j]
             
-            # get shared bunch profile for current bunch
-            center = beam.mpi.center_all[j]
-            profile = beam.mpi.profile_all[j]
-            bin_length = center[1]-center[0]
-            charge_per_mp = beam.mpi.charge_per_mp_all[j]
+            if beam.mpi_switch:
+                # get shared bunch profile for current bunch
+                center = beam.mpi.center_all[j]
+                profile = beam.mpi.profile_all[j]
+                bin_length = center[1]-center[0]
+                charge_per_mp = beam.mpi.charge_per_mp_all[j]
+                if index == self.bunch_index:
+                    sorted_index = beam.mpi.sorted_index
+            else:
+                # get bunch profile for current bunch
+                (bins, sorted_index, profile, center) = bunch.binning()
+                bin_length = center[1]-center[0]
+                charge_per_mp = bunch.charge_per_mp
+                self.bunch_index = index
             
-            if index == self.bunch_index:
-                sorted_index = beam.mpi.sorted_index
-                energy_change = bunch["tau"]*0
+            energy_change = bunch["tau"]*0
             
             # phasor is given at t=0 synchronous particle of the bunch
             # remove part of beam phasor decay to be at the start of the binning
             self.phasor_decay(center[0], ref_frame=ref_frame)
             
             if index != self.bunch_index:
-                self.phasor_evol(profile, bin_length, charge_per_mp)
+                self.phasor_evol(profile, bin_length, charge_per_mp, ref_frame=ref_frame)
             else:
                 # modify beam phasor
                 for i, center0 in enumerate(center):
                     mp_per_bin = profile[i]
                     
                     if mp_per_bin == 0:
-                        self.phasor_decay(bin_length)
+                        self.phasor_decay(bin_length, ref_frame=ref_frame)
                         continue
                     
                     ind = (sorted_index == i)
-                    Vgene = self.Vg*np.cos(self.m*self.ring.omega1*bunch["tau"][ind] + self.theta_g)
+                    phase = self.m * self.ring.omega1 * (center0 + self.ring.T1* (j + self.ring.h * self.nturn))
+                    Vgene = self.Vg*np.cos(phase + self.theta_g)
                     Vbeam = np.real(self.beam_phasor)
                     Vtot = Vgene + Vbeam - charge_per_mp*self.loss_factor*mp_per_bin
                     energy_change[ind] = Vtot / self.ring.E0
@@ -246,18 +255,24 @@ class CavityResonator():
         if self.tracking is False:
             self.init_tracking(beam)
             
-        n_turn = int(self.filling_time/self.ring.T0*5)
+        n_turn = int(self.filling_time/self.ring.T0*10)
         
         for i in range(n_turn):
             for j, bunch in enumerate(beam.not_empty):
                 
                 index = self.valid_bunch_index[j]
                 
-                # get shared bunch profile for current bunch
-                center = beam.mpi.center_all[j]
-                profile = beam.mpi.profile_all[j]
-                bin_length = center[1]-center[0]
-                charge_per_mp = beam.mpi.charge_per_mp_all[j]
+                if beam.mpi_switch:
+                    # get shared bunch profile for current bunch
+                    center = beam.mpi.center_all[j]
+                    profile = beam.mpi.profile_all[j]
+                    bin_length = center[1]-center[0]
+                    charge_per_mp = beam.mpi.charge_per_mp_all[j]
+                else:
+                    # get bunch profile for current bunch
+                    (bins, sorted_index, profile, center) = bunch.binning()
+                    bin_length = center[1]-center[0]
+                    charge_per_mp = bunch.charge_per_mp
                 
                 # phasor is given at t=0 synchronous particle of the bunch
                 # remove part of beam phasor decay to be at the start of the binning
@@ -308,7 +323,7 @@ class CavityResonator():
         self.phasor_decay(deltaT, ref_frame)
         
         # Phasor evolution due to induced voltage by marco-particles
-        k = np.arange(1, n_bin + 1)
+        k = np.arange(0, n_bin)
         var = np.exp( (-1/self.filling_time + 1j*delta) * 
                      (n_bin-k) * deltaT )
         sum_tot = np.sum(profile * var)