Add some more terms coverage; fix NPE when terms is called with a startsWith value that doesn't exist