fix term filtering and term matching