Fixed crash when merging documents with shared base in history