Added beforeCopy hook