some bugs fixed by zhao