Fixed a bug in the code that checks for deletes and backspaces