Fix another template selection bug