You sure you didn't add it after the query inside if ($savecopy) { }? The queries do look very similar at the beginning
If your users do not elect to save copies of their private messages, then this hack would not work, if that's where you added them. You have to add them in the query that is right after this line:
// enhanced - added $receipt to insert
Thanks for the great hack, Commish!