FIX: fix bug in calibration