// the writeInstance loop above may have inserted tags after what used yo be the current tag,
// so let's make sure 'tag' point to the current tag again.
while (tag->next)
// the writeInstance loop above may have inserted tags after what used yo be the current tag,
// so let's make sure 'tag' point to the current tag again.
while (tag->next)