fix template position ordering

We have played around with templates that were using overlapping positions (one on top of another). All of a sudden the order of those position changed which broke the template

This fix makes the order deterministic. 

The best solution would be if the positions can be manually ordered, but this functionality might only be beneficial for a really small set of use cases, and given the fact that you can work around a missing manual ordering by creating the positions one after another (or switching the config between existing positions), this fix should be sufficient.