Important fixes in merge implementation.