changed template unless condition to if