Cox had a psychiatric evaluation before being deemed competent to stand trial.
I'm surprised they found a psychiatrist who was willing to say that someone is competent to stand trial. Psychiatrists generally say that everyone is nuts except them.
Actually, that's not accurate. It's pretty hard to be ruled incompetent-- you have to basically not be able to understand who the judge is or what your attorney's function is.
And "getting off on insanity" is also more difficult than it is made out to be.