modify some bugs
merge code