fix: better detection of template