modified save/restore calibration state, bug fixes