Verify the magnet is in place when you pull it apart.
Keep in mind that the code 41 may be an ICM (ignition control module beneath the coils), crank sensor, or cam sensor. The Cam sensor signal travels throug the ICM and crank sensor before getting to the PCM.
Inspect your connections at the ICM and the crank sensor harness to make sure nothing is damaged.
Do you have an ohmmeter? If so, check the wires:
Brown/white wire from the cam sensor Pin A to pin J at the ICM. Should be very low resistance (continuity).
Check the ICM Pin M (red/black) to pin B on the cam sensor. Should also be good.
Check Pin C of the Cam sensor (wht/blk) to pin M of the ICM.
Do you have a spare ICM from the old motor to swap in for troubleshooting? Do you have any bent pins on the ICM or it'* connector? Any corrosion?