correct template filtering