Corrected processing of modules

in the end of the simulation algorithm