fix errors when merging deeply nested values