some changes in motor.c