fix bug with deleting characters