bug fix on restart of a simulation.
improve code quality metrics (III).