adding check for valid filter