tmf: Fixed the merge method and added another test case for it.