Fixing a bug where ReferenceEquals was called on value types.