diff --git a/src/utils/FileRecordTools/Records/BamRecord.cpp b/src/utils/FileRecordTools/Records/BamRecord.cpp
index fda5a28bbb43bcee238d071f905e5d9932067128..cde07329a2dffb56905d700e532c913cb092c8fa 100644
--- a/src/utils/FileRecordTools/Records/BamRecord.cpp
+++ b/src/utils/FileRecordTools/Records/BamRecord.cpp
@@ -148,10 +148,10 @@ void BamRecord::printRemainingBamFields(QuickString &outBuf, RecordKeyList *keyL
 }
 
 void BamRecord::printUnmapped(QuickString &outBuf) const {
-	outBuf.append(_chrName);
+	outBuf.append(_chrName.empty() ? "." : _chrName);
 	outBuf.append("\t-1\t-1\t");
-	outBuf.append(_name);
+	outBuf.append(_name.empty() ? "." : _name);
 	outBuf.append('\t');
-	outBuf.append(_score);
+	outBuf.append(_score.empty() ? "." : _score);
 	outBuf.append("\t.\t-1\t-1\t-1\t0,0,0\t0\t.\t."); // dot for strand, -1 for blockStarts and blockEnd
 }
diff --git a/test/intersect/a_with_bothUnmapped.bam b/test/intersect/a_with_bothUnmapped.bam
new file mode 100644
index 0000000000000000000000000000000000000000..c8959e5be8ce17babfed2100134abd8e575fbf1f
Binary files /dev/null and b/test/intersect/a_with_bothUnmapped.bam differ
diff --git a/test/intersect/mapped_and_unmapped.sam b/test/intersect/mapped_and_unmapped.sam
deleted file mode 100644
index 111b41d113d476e91364c513c7ce81996ed077a3..0000000000000000000000000000000000000000
--- a/test/intersect/mapped_and_unmapped.sam
+++ /dev/null
@@ -1,4 +0,0 @@
-@HD	VN:1.0	GO:none	SO:coordinate
-@SQ	SN:chr1	LN:249250621
-mapped	16	chr1	1	40	30M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
-umapped	4	*	1	40	30M	*	0	0	GAAGGCCACCGCCGCGGTTATTTTCCTTCA	CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI	MD:Z:50
diff --git a/test/intersect/new_test-intersect.sh b/test/intersect/new_test-intersect.sh
index 6f21ef16bd9dce382c3a3978d6abf342c4521b9c..e23ff4bf2be510102f69d5101d1022e721a31e79 100755
--- a/test/intersect/new_test-intersect.sh
+++ b/test/intersect/new_test-intersect.sh
@@ -12,10 +12,218 @@ check()
 ###########################################################
 #  Test intersection of a as bed from file vs b as bed from file
 ############################################################
-echo "    intersect.t01...\c"
+echo "    intersect.new.t01...\c"
 echo \
 "chr1	100	101	a2	2	-
 chr1	100	110	a2	2	-" > exp
 $BT intersect -a a.bed -b b.bed > obs
 check obs exp
 rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bed from redirect vs b as bed from file
+############################################################
+echo "    intersect.new.t02...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a - -b b.bed < a.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bed from pipe vs b as bed from file
+############################################################
+echo "    intersect.new.t03...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+cat a.bed | $BT intersect -a - -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bed from fifo vs b as bed from file
+############################################################
+echo "    intersect.new.t04...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a <(cat a.bed) -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as gzipped from file vs b as bed from file
+############################################################
+echo "    intersect.new.t05...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a a_gzipped.bed.gz -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as gzipped from redirect vs b as bed from file
+############################################################
+echo "    intersect.new.t06...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a - -b b.bed < a_gzipped.bed.gz > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as gzipped from pipe vs b as bed from file
+############################################################
+echo "    intersect.new.t07...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+cat a_gzipped.bed.gz | $BT intersect -a - -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as gzipped from fifo vs b as bed from file
+############################################################
+echo "    intersect.new.t08...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a <(cat a_gzipped.bed.gz) -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bgzipped from file vs b as bed from file
+############################################################
+echo "    intersect.new.t09...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a a_bgzipped.bed.gz -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bgzipped from redirect vs b as bed from file
+############################################################
+echo "    intersect.new.t10...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a - -b b.bed < a_bgzipped.bed.gz > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bgzipped from pipe vs b as bed from file
+############################################################
+echo "    intersect.new.t11...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+cat a_bgzipped.bed.gz | $BT intersect -a - -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bgzipped from fifo vs b as bed from file
+############################################################
+echo "    intersect.new.t12...\c"
+echo \
+"chr1	100	101	a2	2	-
+chr1	100	110	a2	2	-" > exp
+$BT intersect -a <(cat a_bgzipped.bed.gz) -b b.bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of a as bam from file vs b as bed from file
+############################################################
+echo "    intersect.new.t13...\c"
+$BT intersect -a a.bam -b b.bed> obs
+check obs aVSb.bam
+rm obs
+
+
+###########################################################
+#  Test intersection of a as bam from redirect vs b as bed from file
+############################################################
+echo "    intersect.new.t14...\c"
+$BT intersect -a - -b b.bed < a.bam> obs
+check obs aVSb.bam
+rm obs
+
+
+###########################################################
+#  Test intersection of a as bam from pipe vs b as bed from file
+############################################################
+echo "    intersect.new.t15...\c"
+cat a.bam | $BT intersect -a - -b b.bed> obs
+check obs aVSb.bam
+rm obs
+
+
+###########################################################
+#  Test intersection of a as bam from fifo vs b as bed from file
+############################################################
+echo "    intersect.new.t16...\c"
+$BT intersect -a <(cat a.bam) -b b.bed > obs
+check obs aVSb.bam
+rm obs
+
+
+###########################################################
+#  Test intersection of bam file containing both good reads
+#  and those where both read and mate are unmapped vs b file
+#  as bed.
+############################################################
+echo "    intersect.new.t17...\c"
+echo \
+"chr1	100	101	a2	255	-	100	200	0,0,0	1	100,	0,
+chr1	100	110	a2	255	-	100	200	0,0,0	1	100,	0," > exp
+$BT intersect -a a_with_bothUnmapped.bam -b b.bed -bed > obs
+check obs exp
+rm obs exp
+
+
+###########################################################
+#  Test intersection of bam file containing both good reads
+#  and those where both read and mate are unmapped vs b file
+#  as bed, with noHit (-v) option. 
+############################################################
+echo "    intersect.new.t18...\c"
+echo \
+"chr1	10	20	a1	255	+	10	20	0,0,0	1	10,	0,
+.	-1	-1	FCC1MK2ACXX:1:1101:5780:51632#/1	0	.	-1	-1	-1	0,0,0	0	.	.
+.	-1	-1	FCC1MK2ACXX:1:1101:5780:51632#/2	0	.	-1	-1	-1	0,0,0	0	.	.
+.	-1	-1	FCC1MK2ACXX:1:1101:8137:99409#/1	0	.	-1	-1	-1	0,0,0	0	.	.
+.	-1	-1	FCC1MK2ACXX:1:1101:8137:99409#/2	0	.	-1	-1	-1	0,0,0	0	.	.
+.	-1	-1	FCC1MK2ACXX:1:1102:6799:2633#/1	0	.	-1	-1	-1	0,0,0	0	.	.
+.	-1	-1	FCC1MK2ACXX:1:1102:6799:2633#/2	0	.	-1	-1	-1	0,0,0	0	.	." > exp
+$BT intersect -a a_with_bothUnmapped.bam -b b.bed -bed -v > obs
+check obs exp
+#rm obs exp
+
+
+
+
+
+
+