optimize game, fix some bugs