Bug fixes on sensor calibration