fix some code errors