Problem with Ragdoll Rotating

Well, this one is new to me. I compiled a model and at first it looks like this in ragdoll pose:

Only to find that the model does this when I switch to running/anything else:

Even the reference pose:

So does anyone know what’s causing this? I assume it has to do with bones rotating or being left over from the original model: