Fix for a bug within the Trie class.

@andyberry88: Can you please take a look at the tests for this and add
any missing coverage when you get a chance?