Added in test for when term does not appear in dictionary, along with correspondig fix