some bugs fixes