add merging script based on hadd