Fix bugs in key codes.