diff --git a/docs/conf.py b/docs/conf.py
index f5c2ebf95bdb8b10df40cbda68b555f152e12108..e20ce34ce32205f02aad9e96b543cb7383fd0bcc 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -51,9 +51,9 @@ copyright = u'2009 - 2013, Aaron R. Quinlan'
 # built documents.
 #
 # The short X.Y version.
-version = '2.19.0'
+version = '2.19.1'
 # The full version, including alpha/beta/rc tags.
-release = '2.19.0'
+release = '2.19.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/src/utils/fileType/fileType.cpp b/src/utils/fileType/fileType.cpp
index 8589557f733ad15fb8d77060386522459651eb09..6c075144dc858f721146789167d85c88e0fd6337 100644
--- a/src/utils/fileType/fileType.cpp
+++ b/src/utils/fileType/fileType.cpp
@@ -70,7 +70,7 @@ bool isGzipFile(istream *file) {
         by John Marshall in response to Issue 30:
         https://github.com/arq5x/bedtools/issues/30
  */
-    if (file->peek() != 0x1f)
+    if (file->peek() == 0x1f)
     {
         return true;
     }
diff --git a/test/general/test-general.sh b/test/general/test-general.sh
index 6028bf15ebfea397443114f1b82ee2e67ecb05ae..38b3f6e80e36c3c39659fc41da5ef9697a0049cf 100644
--- a/test/general/test-general.sh
+++ b/test/general/test-general.sh
@@ -96,3 +96,191 @@ check obs exp
 rm obs exp
 
 
+###########################################################
+#  Test GZIP, non-GZIP, and empty file functionality.
+###########################################################
+echo "chr1	1	100" > a.bed
+echo "chr1	75	200" > b.bed
+echo -n "" > c.bed
+echo "chr1	1	5000" > genome.txt
+gzip -c a.bed > a.bed.gz
+gzip -c b.bed > b.bed.gz
+gzip -c c.bed > c.bed.gz
+
+
+echo "    general.t09...\c"
+$BT intersect -a a.bed -b b.bed > obs
+echo "chr1	75	100" > exp
+check obs exp
+
+echo "    general.t10...\c"
+$BT intersect -a a.bed.gz -b b.bed.gz > obs
+echo "chr1	75	100" > exp
+check obs exp
+
+echo "    general.t11...\c"
+$BT intersect -a a.bed -b b.bed.gz > obs
+echo "chr1	75	100" > exp
+check obs exp
+
+echo "    general.t12...\c"
+$BT intersect -a a.bed.gz -b b.bed > obs
+echo "chr1	75	100" > exp
+check obs exp
+
+echo "    general.t13...\c"
+$BT intersect -a c.bed -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.t14...\c"
+$BT intersect -a c.bed.gz -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.15...\c"
+$BT intersect -a c.bed.gz -b c.bed.gz > obs
+echo -n "" > exp
+check obs exp
+
+
+echo "    general.t16...\c"
+$BT subtract -a a.bed -b b.bed > obs
+echo "chr1	1	75" > exp
+check obs exp
+
+echo "    general.t17...\c"
+$BT subtract -a a.bed.gz -b b.bed.gz > obs
+echo "chr1	1	75" > exp
+check obs exp
+
+echo "    general.t18...\c"
+$BT subtract -a a.bed -b b.bed.gz > obs
+echo "chr1	1	75" > exp
+check obs exp
+
+echo "    general.t19...\c"
+$BT subtract -a a.bed.gz -b b.bed > obs
+echo "chr1	1	75" > exp
+check obs exp
+
+echo "    general.t20...\c"
+$BT subtract -a c.bed -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.t21...\c"
+$BT subtract -a c.bed.gz -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.22...\c"
+$BT subtract -a c.bed.gz -b c.bed.gz > obs
+echo -n "" > exp
+check obs exp
+
+
+echo "    general.t23...\c"
+$BT window -a a.bed -b b.bed > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t24...\c"
+$BT window -a a.bed.gz -b b.bed.gz > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t25...\c"
+$BT window -a a.bed -b b.bed.gz > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t26...\c"
+$BT window -a a.bed.gz -b b.bed > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t27...\c"
+$BT window -a c.bed -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.t28...\c"
+$BT window -a c.bed.gz -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.29...\c"
+$BT window -a c.bed.gz -b c.bed.gz > obs
+echo -n "" > exp
+check obs exp
+
+
+echo "    general.t30...\c"
+$BT closest -a a.bed -b b.bed > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t31...\c"
+$BT closest -a a.bed.gz -b b.bed.gz > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t32...\c"
+$BT closest -a a.bed -b b.bed.gz > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t33...\c"
+$BT closest -a a.bed.gz -b b.bed > obs
+echo "chr1	1	100	chr1	75	200" > exp
+check obs exp
+
+echo "    general.t34...\c"
+$BT closest -a c.bed -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.t35...\c"
+$BT closest -a c.bed.gz -b b.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.36...\c"
+$BT closest -a c.bed.gz -b c.bed.gz > obs
+echo -n "" > exp
+check obs exp
+
+
+echo "    general.t37...\c"
+$BT merge -i a.bed > obs
+echo "chr1	1	100" > exp
+check obs exp
+
+echo "    general.t38...\c"
+$BT merge -i a.bed.gz > obs
+echo "chr1	1	100" > exp
+check obs exp
+
+echo "    general.t39...\c"
+$BT merge -i b.bed > obs
+echo "chr1	75	200" > exp
+check obs exp
+
+echo "    general.t40...\c"
+$BT merge -i b.bed.gz > obs
+echo "chr1	75	200" > exp
+check obs exp
+
+echo "    general.t41...\c"
+$BT merge -i c.bed > obs
+echo -n "" > exp
+check obs exp
+
+echo "    general.t42...\c"
+$BT merge -i c.bed.gz > obs
+echo -n "" > exp
+check obs exp
+
+rm a.bed.gz b.bed.gz a.bed b.bed genome.txt
+