improved keyboard input focus. fixed boolean error that caused crash.