HMC5883L compass huge error [SOLVED]

Could it be too close to the 328 processor? The other chip didn't mind.

It's a simple algorithm to transform the wrong heading to the right one:

if heading <90 then heading*=2;
if heading >=90 <270
heading=180+(heading-90)/2
//else already correct within degree or 2

But why?

New problem:
At E,W it's extremely sensitive to tilt, but not N,S;
The Z value does not change when it's level or near level, so there's no way to adjust the X,Y heading?
I think this chip is a piece of junk, and many others agree?