bet function is working