fix for problem with variable time step