improved velocity calculation #620