Fixed div. by zero error in max velocity calculation