fix filter logic