Only store the filter variable when it is valid.