change some codes & fix some errors