Converting sorting of template id to numerical