gracefully handle  nil events
Check for empty elements before creating xml nodes
Merge branch 'develop'