              ((and (integerp evt)
                    (char-equal evt skey))
               ;; remove the f character
-              (if insert? (funcall deletef))
+              (if delete? (funcall deletef))
               (set-buffer-modified-p modified)
               (funcall callback))
              (t ; otherwise

          (delete-char -1)))

      (evil-define-command spacemacs/escape-state
        (keys shadowed insert? callback &optional insert-func delete-func)
        "Allows to execute the passed CALLBACK using KEYS. KEYS is a cons cell
of 2 characters. If INSERT? is not nil then the first key pressed is inserted
 using the function INSERT-FUNC and deleted if required using DELETE-FUNC."
        :repeat change
        (let* ((modified (buffer-modified-p))
               (insertf

             (shadowed (lookup-key evil-motion-state-map key)))
        ;; 'fd' triggers to escape from a state to the base state
        (global-set-key key `(lambda () (interactive)
                               (spacemacs/escape-state ',seq nil nil nil 'keyboard-quit)))
        (mapc (lambda (map)
                (define-key (eval map) key
                  `(lambda () (interactive)
                     (spacemacs/escape-state ',seq nil t nil 'abort-recursive-edit))))
              '(minibuffer-local-map
                minibuffer-local-ns-map
                minibuffer-local-completion-map
