local and global merge