fixed a bug that merging shouldn't change original lists. and added unit test.