fixed an obscure bug related to backspace in insert mode

The bug was found by clang's static analyzer. I'm still not sure about
the conditions under which the bug could occur, but I trust clang more
than myself.