fix freezing problem in emacs