some bugs fixing