Fix filtered record counts being incorrect