Fixed calibration math and IO