fixed encode and decodeTable