I've been playing with this mod for a bit, and ever since I started using the processors, sometimes ghosts get built by themselves for no reason.
Looking into your code, you do revive ghosts under certain circumstances, but I can't tell exactly with which context it's supposed to work from just looking at the code.