workaround to C-g crashing emacs in terminal