some bugs fixed