add barrier to template