Fixed bugs in row count when a filter is specified