some changes for keyhandling