Fixed what looked like segfault in calibration routines.