do SafeRecurse function local to cg