fix some error in the code