Pole target twisting leg after mocap retarget

Hi everyone,

Successfully retargeted a .bvh on an autorig pro rig, but I’m having issues with the pole targets of the legs. Most of the time they’re fine, but sometimes they move to the back of the leg, causing the leg to twist. How can I fix this so it doesn’t happen? Thanks so much in advance!