sorted template issue