Minor fixes in document sanitization