various key event bug fixes