Problem with dodge mechanic

I’m trying to make a simple dodge system that gives the player a quick boost of speed in the direction that they are currently walking when the space key is pressed. This system that I’ve made works fairly well so far, except for on really weird problem. When I dodge forward, left, or right, it moves exactly as far as it should. However, when I use it while going backward, it sends me flying extremely far for some reason. I can’t figure out why this is happening. Any potential solutions would be appreciated.