fix encode/deocde issue