fixed a bug when encoding prefixes