fix key event hook, minor changes