fixed bug in getVelocity