fix bug with speed computation