Fix an encoder bug