fixed RK4 functions