ammend some bugs, including some codes that are unuseful