Fixed version handling of documents