revised some bugs