Support encode/decode for Option type