avoid segfault on keypress