change a lot and fix some bugs