factor before using roots quadratic (replaces #2520)

closes #2520