fix some bugs and add Ad