sort template vars