Promblem with ragdoll rotation

Hi. I am having problems trying to limit the rotation for my ragdoll, some of the joints keep over rotating making the mesh bend in very unnatural ways. Any ideas to fix this?

When I hear ragdoll, I think of ragdoll physics. Without knowing how you have you doll rigged or how you are going about manipulating it, my only though would be a constraint on limiting rotation: