How can I fix these twisted bones?

Hi!

I just came across the following problem, where a few bones are… twisted/misplaced. In Blender, they look just fine. The rig is set to generic. Do you have any ideas? Thank you!