Correcting a bug in calibrate_refine