Bugfix: failed to write HTML if an element had an empty set of children. More tests