Limbstick glitch when looping last frame to first

Sometimes when I run a Limbstick script, the hand/foot location in the last frame matches the first but the values of the dials (bend, side-side, twist) of all the connecting bones (arms, thighs, etc) are so dramatically different between the first and the last frame, that it creates a huge, ugly glitch when looping the last frame to the first.
Anyone ran into this problem? Any ideas how to solve it?