removed second length check in trie, and andded penaltysum where forgot