fix some code and remove some useed code