make some modifications to fix some bugs