debug the root finding function