fix backspace bug, simplify a bit