modified Term isValid to check denominators