Remove lexical scope and emacs 24 dependency