some fix
1. add some functions
2. fix some bugs