fix mode change/backspace bug