This is probably a dumb thing to ask but is the hammer cocked when you try to put the safety on?
The safety only engages with the hammer back.
If that isn't the problem you may want to take a peek inside the trigger ssaembly and see what it's hanging on. Most likely the disconnector is sitting too low for the safety switch to pass under it.