Fix document validation