diff --git a/tracking/rf.py b/tracking/rf.py
index bb2f42d55e9b0d7bcb17d00b37522ef07cb751a4..a8f34862d539d5fe8defede2d8a820d92c8f1991 100644
--- a/tracking/rf.py
+++ b/tracking/rf.py
@@ -215,11 +215,13 @@ class CavityResonator():
             if beam.filling_pattern[index]:
                 
                 if beam.mpi_switch:
+                    # get rank of bunch n° index
+                    rank = beam.mpi.bunch_to_rank(index)
                     # mpi -> get shared bunch profile for current bunch
-                    center = beam.mpi.tau_center[index]
-                    profile = beam.mpi.tau_profile[index]
+                    center = beam.mpi.tau_center[rank]
+                    profile = beam.mpi.tau_profile[rank]
                     bin_length = center[1]-center[0]
-                    charge_per_mp = beam.mpi.charge_per_mp_all[index]
+                    charge_per_mp = beam.mpi.charge_per_mp_all[rank]
                     if index == self.bunch_index:
                         sorted_index = beam.mpi.tau_sorted_index
                 else: