actually encode/decode binary and null head properly