Looks like insertion of nil translates into insertion of an empty document. This should be treated as an error instead.