Fixes to motor lib