sort options in templates