Added obj.ReferenceEquals for null checks.