Fix position indexes

Position indexes ksort on template build.