fixed template logic