fix key handler bug