protection against invalid document structures