Workaround to prevent crash during mag calibration

This seems to resolve #378.