fix a bug causing no intermediate ouptut when duration of simulations can't be divided by the frequency of intermediate output