Stop losing forward velocity when moving sideways

I have this problem too! I am trying to make a game similar to this but my character loses forward velocity when moving forward. I made a workaround where i increase the movement speed when moving to the side, but this solution is full of bugs and consumes a lot of performance. I hope someone finds a solution!