fix some bugs and add new features