speed calculation bugfix