improved keyboard exception handler