fix some bugs and advices