Fixes bug which caused backspace to delete too many characters in a few cases.