Many approximate methods of quantum chemistry yield potential energy surfaces with discontinuities. While clearly unphysical, such features often fall within the typical error bounds of the method, and cannot be easily eliminated. The integration of nuclear trajectories when the potential energy is locally discontinuous is obviously problematic. We propose a method to smooth out the discontinuities that are detected along a trajectory, based on the definition of a continuous function that fits locally the computed potential, and is used to integrate the trajectory across the discontinuity. With this correction, the energy conservation error can be reduced by about one order of magnitude, and a considerable improvement is obtained in the energy distribution among the internal coordinates.