fixed some problems with AptMotor class
fix bugs and clean up new AptMotor class