adding isset checks to spellcheckQuery