Fix logic in adding filter.