Improve UUID handling of documents