add auto clean, fix some bugs