Fixed bugs in joystick to motor value function