fix some bugs stop ai from playing.