Mostly revert latest changes to r_poly.c