Bad things don't happen to good people, and good people don't do bad things or associate with bad people.
If someone gets arrested or convicted for doing something bad, then you associating with them must mean that either (1) you are also a bad person, or (2) bad things do in fact happen to good people, and could happen to you.
This would suggest that a way to fix things would be to publicize that the system has a disturbingly high error rate (bad things do in fact happen to good people) and the damage from that needs to be reduced. Another way would be to get rid of the belief that (getting caught) doing one bad thing makes you forever a bad person, but that would require working against how intolerance seems to feed on itself...