Fixes for the case when emacs is running in a terminal.