Pawn movement around planet issue

Hi everybody, I started working on a new project with small planets and space exploration. I created the player pawn as the main character and I made the walking system. Everything seemed fine until i discovered this issue: while walking around the planet the pawn moves around two poles in a spiral and if too close it gets to the center and starts rotating in place.
I noticed that this happens when Y and Z rotations are both =90°. Is there a way I can avoid this to happen?
Here the blueprint parts for the movement:


And a video where I’m moving straight forward showing the issue (actor rotation in print string)
https://youtu.be/r9XWw6qaNvM

Hi there,

Have you tried using this node instead of doing the calculation by impact point with trace direction?