Correct a problem with sort order in template selection.