fixed some bugs in controller with calibrate