Fix checking of template attribute to avoid errors