I'm guessing you're calling
Code:
GetBindingByKey(key)
when the client's loading starts. The keybinds information isn't available immediately, you need to wait for the
event.
Running your code in-game after login and loading gets the right keybinding for me.