Fix ptrie serialization.

The serialized ptrie is slightly bigger than the original dictionary (around 1.5 times as big).