bugfix in handlekeyboardevents