explicit handling of nil/optional in zkEnvelope
use addElementArray when we know its definitely an array
use nillable/optional where needed
update other samples