Calibrating the compass