cpmac: fix race condition (closes #3019)