term.length() fixes