 #ifndef NEWTON_UNROLL
             if (NewtonDone) break;
 #else //only break if it's at the end of the unroll
-            if(NewtonDone && (NewtonIter + 1) % NewtonIter == 0) break;
+            if(NewtonDone && (NewtonIter + 1) % NEWTON_UNROLL == 0) break;
 #endif
             if (NewtonIter >= NewtonMaxit)
             {

#ifndef NEWTON_UNROLL
            if (NewtonDone) break;
#else //only break if it's at the end of the unroll
            if (NewtonDone && (sNewtonIter + 1) % sNewtonIter == 0) break;
#endif
        }
        if (!NewtonDone) {

 */
__device__ void integrate (const double t_start, const double t_end, const double pr, double* y) {
	double Hmin = 0;
	double Hold = 0;
#ifdef Gustafsson
	double Hacc = 0;
