Fixing incorrect usage of the function MPI_Buffer_detach