Fix a traceback when the terminal is not behaving as it should