try to customize encode/decode