Merger and fix some bugs