Add logging to merging
Add missing keyref processing to copy-to targets