fix set speed function
updated example