Not sure if I'm correct but you have to make sure that your skeleton joints are straight. You can zero out numbers that needs to be zeroed out with "freeze transforms" Then try to re-apply ik handle.