diff --git a/R/correlationMatrix.R b/R/correlationMatrix.R
index 7bb78bc5ca65095528b6c381897bd226a4fbd636..0ec255f0760b549df24419cdda07af38d4f0e909 100644
--- a/R/correlationMatrix.R
+++ b/R/correlationMatrix.R
@@ -138,7 +138,9 @@ 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)
-        testMat <- testMat[-which(apply(testMat, 1, sd) == 0), ]
+        to_remove <- which(apply(testMat, 1, sd) == 0)
+        testMat <- testMat[-to_remove, ]
+        genoMap <- genoMap[-to_remove, ]
         to_remove <- NULL
         for (i in 1:nrow(testMat)) {
             if (!(rownames(testMat)[i] %in% lrsid)) {