fix some bugs from the merge