fix bug on count the deleted matching Statements

- the count is wrong because of overwriting the $filter variable and wrong accessing of the $result variable