correct some error and change some API