cleanup encode/decode a bit