Fixes Trie.toMap to preserve keys

Fixes Trie.nearest to preserve keys prefix