velocity calculation fix