Improved reliability of locate_template