fixed bug in tolerance for Newton-Raphson loop