fix wrong permission check in template