some bugs fixed and improvement