Fixing some bugs & betting code