Finally fixed potential issue of printing an empty element as a void element.