encode/decode debugged