update HW2(fix some bugs)