context_permissions bug fix