Fix writing empty avro objects

An empty datum is created, passed by value to the DecodeV8 function.
But later the original (empty) datum is saved.
This also fixes the cause that made a number of unit tests fail.