improved handling the speed value