From what I heard 2 years ago.., to stop them from spawning from the inside to outside. You have to destroy the original block and replace it with a new one. Dig up dirt and add new one or you can add torch from the outside. If you have a huge spacious area inside your fencing you can add a wooded block in the middle to stop them from spawning. I did it with my military base I found and didn’t had a problem with zombie spawning.