fix some bugs and add some features