Fix  some bugs