bKeyCount() might be the problem here as it might not be respecting filters ...?
Likely.
Actually the Loop should end when either nRow > Eval(
bKeyCount ) .or. Eval( bSkip, 1 ) != 1, whichever happens first.
You can try checking behavior of these codeblocks.