Fixes to security context