refine counter to properly track deleted characters