fixed bug in calibrate