Update imu.cpp

Fix a couple of porting errors.