added all=T option to merge