diff --git a/R/correlationMatrix.R b/R/correlationMatrix.R
index 0ec255f0760b549df24419cdda07af38d4f0e909..c2bea09861ab4763491517c6204e6f48be221913 100644
--- a/R/correlationMatrix.R
+++ b/R/correlationMatrix.R
@@ -138,9 +138,11 @@ getGenoCorMatrix <- function(lrsid, lchr, lpos, lrefall, pop, path = NULL, web =
         lind <- lind[lind$Paternal.ID == 0 & lind$Maternal.ID == 0, 2]
         
         testMat <- getAdditivelyCodedMatrix(genoMat,lind)
-        to_remove <- which(apply(testMat, 1, sd) == 0)
-        testMat <- testMat[-to_remove, ]
-        genoMap <- genoMap[-to_remove, ]
+        to_remove <- which(apply(testMat, 1, sd) == 0))
+        if (length(to_remove) > 0) {
+            testMat <- testMat[-to_remove, ]
+            genoMap <- genoMap[-to_remove, ]
+        }
         to_remove <- NULL
         for (i in 1:nrow(testMat)) {
             if (!(rownames(testMat)[i] %in% lrsid)) {