Root Motion & Flying mode problems

Hi everyone!

I am using root motion and flying mode to get the z-axis values from the root bone for some climbing animations. However, I found that every time I jump upwards, the character moves further away from the wall (y-axis), even though the root bones values only change on the z-axis. How is this possible?

thanks in advance!