Fixed bugs with calibration