brent method bugs fixed