bug fixes for matlab integrator