added mpi_env, in this way the code is much more readable
fixed an error in chunck calculation