Repaired bug with term/endterm and polyratfun combination.