Fixed the creation of a merged document