fix encodeId