diff --git a/variants/cnvkit.sh b/variants/cnvkit.sh
index 0cc9bb70431893c6dcf19926198bb895c08ed556..3be8a88068fe530ff9f74235df45f14c994be6bf 100644
--- a/variants/cnvkit.sh
+++ b/variants/cnvkit.sh
@@ -29,7 +29,7 @@ if [[ -z $SLURM_CPUS_ON_NODE ]]
 then
     SLURM_CPUS_ON_NODE=1
 fi
-
+baseDir="`dirname \"$0\"`"
 module load cnvkit/0.9.0
 cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_targets.bed -o ${pair_id}.targetcoverage.cnn
 cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_antitargets.bed -o ${pair_id}.antitargetcoverage.cnn
diff --git a/variants/union.sh b/variants/union.sh
index 7e6beba8a5d652da7c51a9fb7ea84c9ca05e5666..391259bb8fe6e899b021921fbb6150bde4819e71 100644
--- a/variants/union.sh
+++ b/variants/union.sh
@@ -35,7 +35,7 @@ for i in *.vcf.gz; do
 	list2="$list2 nooverlap.hotspot.vcf.gz"
     fi
 done 
-
+#echo "$baseDir/unionvcf.pl ${index_path}/union.header.vcf $list2"
 perl $baseDir/unionvcf.pl ${index_path}/union.header.vcf $list2
 perl $baseDir/vcfsorter.pl ${index_path}/genome.dict int.vcf |bgzip > ${pair_id}.union.vcf.gz
 
diff --git a/variants/unionvcf.pl b/variants/unionvcf.pl
index da35d2c4c021019c818f6386dc742e6736fb7d03..c44815b1c5d24096d3f66cb5f35e5bbaabb3c447 100755
--- a/variants/unionvcf.pl
+++ b/variants/unionvcf.pl
@@ -25,11 +25,12 @@ foreach $vcf (@vcffiles) {
 	($chromhd, $posd,$idhd,$refhd,$althd,$scorehd,
 	 $filterhd,$annothd,$formathd,@sampleids) = split(/\t/, $line);
 	foreach $j (0..$#sampleids) {
-	  $sampleids[$j] =~ s/\.final//g;
+	    $sampleids[$j] = (split(/\./,$sampleids[$j]))[0];
 	}
 	unless (@sampleorder) {
 	  @sampleorder = @sampleids;
-	  print OUT $line,"\n";
+	  print OUT join("\t",$chromhd, $posd,$idhd,$refhd,$althd,$scorehd,
+			 $filterhd,$annothd,$formathd,@sampleids),"\n";
 	}
 	next;
       }
@@ -37,9 +38,6 @@ foreach $vcf (@vcffiles) {
     }
     my ($chrom, $pos,$id,$ref,$alt,$score,
 	$filter,$annot,$format,@gts) = split(/\t/, $line);
-    if ($pos == 48303944) {
-      warn "Debugging\n";
-    }
     my %hash = ();
     foreach $a (split(/;/,$annot)) {
       my ($key,$val) = split(/=/,$a);