improving tests around encode/decode