More sorting/template stabilization fixups