fixing Newton-Raphson