Fix issue with avro exceptions when json encoding is used.