removed direct use of is.atomic and is.list, since they have bad NULL corner cases.