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