import missing factor_terms

TR2i was missing factor_terms which is being used in factorize. Perhaps this isn't being covered in tests. It would be great if someone writes a test for this. @smichr please see this.