Fixed calibration function.