Some fixes to the security context for the streaming code