Some fixes for running emacs as a daemon.