fixed the bug of encoding

fixed the bug of encoding