diff --git a/src/modules/mpi/eztrace_convert_mpi_p2p.c b/src/modules/mpi/eztrace_convert_mpi_p2p.c
index 12d3f6e..7195d4f 100644
--- a/src/modules/mpi/eztrace_convert_mpi_p2p.c
+++ b/src/modules/mpi/eztrace_convert_mpi_p2p.c
@@ -396,8 +396,8 @@ static void __remove_message_from_pending_comm(struct mpi_p2p_msg_t* msg,
 					       enum comm_type_t comm_type)
 {
   INIT_MPI_PROCESS_INFO(GET_PROCESS_INFO(cont), process_info);
-  struct ezt_list_token_t *token;
-  ezt_list_foreach(&process_info->pending_comm[comm_type], token) {
+  struct ezt_list_token_t *token, *next;
+  ezt_list_foreach_safe(&process_info->pending_comm[comm_type], token, next) {
     struct mpi_pending_comm* p_comm = (struct mpi_pending_comm*) token->data;
 
     if((p_comm->msg == msg) &&
