diff --git a/tracking/rf.py b/tracking/rf.py
index 49a743b1b821c65f60c228bbce1c6b98c199d274..f34958b62f67a7dc914cc7e432698c1c4ac7fd36 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: