Correct bug when sorting filtered data.