improve encode format for message marshalling