Disabling walk key when sprinting

Hi, so ive been fiddling with a third person template and added sprinting and walking, the problem ive been having is that i have separate keys set for sprinting and walking, sprint is assigned L-Shift, walk assigned to L-Alt, if i make the character sprint with L-Shift and i press the L-Alt key to make him walk, the character will then walk but as soon as the key is released the game/engine locks up and freezes for about 20 seconds or so and does not do anything, so i figured to get around this problem i should disable the L-Alt key while using L-shift and vice versa.

I had a go at using a bool with branches to check the state and disable the respective keys, except when i tried this the L-shift keys function to sprint did not work anymore, the L-Alt key for walking did, but the game/engine still locked up and froze for 20 seconds or so again, i have searched the forums, documentation, YT and google but couldnt quite find an answer, could anyone shed some light on how to go about this properly?

Alt+W is a Windows key, Alt+S is a Windows key and Alt+D is a Windows key.

You may be experiencing these pauses because the system is catching up to what it thinks you want to do, assuming that you are pressing one of those keys while pressing the Alt key.

I would make the Shift a toggle between the Sprint and Walk, if that would fit into your design plans.