Replaced a call to == with ReferenceEquals when checking for null to avoid cycles in == operators