Fixed template if statement