correct filter logic slightly