I have an old Lego compass and I have noticed that it needs a bit of time to settle if the robot was moving and the measurements are not reliable while in motion, even it it is a streight line. This sensor is similar with the Devantech CMPS03, I had the same problems with that one too. So, it may be a good idea to keep the robot still while checking the compass, then let it move. Why? because of magnetic interference from the motors.