diff --git a/src/Input/input.cxx b/src/Input/input.cxx
index d150dd93e..1bf4b962a 100644
--- a/src/Input/input.cxx
+++ b/src/Input/input.cxx
@@ -251,6 +251,8 @@ FGInput::doKey (int k, int modifiers, int x, int y)
   if (!_key_code)
     return;
 
+  k = _key_code;
+  modifiers = _key_modifiers | (_key_pressed ? KEYMOD_NONE : KEYMOD_RELEASED);
   button &b = _key_bindings[k];
 
                                 // Key pressed.