set default behaviour of mergePrincipalAttributes to true. 
add nullcheck