Fixed the issue where the motor could get stuck at its limits