Merge in upstream memset fix, and a few minor tweaks to copy_template.S