Fixed bug that was ignoring a step at the end of the simulation.