fixes LUX-71: NPE when inserting non-XML documents
merged fix for LUX-71 from lux-0.10