Fixed some bugs in calib code and tdt_lib for Spatial PDR code.