diff --git a/gaussian.go b/gaussian.go
index caf9c434f867db174ea028c7143d48cd5a455b98..63bc15252979ed7e73b41b1773581bb3aec48eea 100644
--- a/gaussian.go
+++ b/gaussian.go
@@ -109,7 +109,7 @@ func (f *F2) partialDiagonalize(startRow, startCol, stopRow, stopCol int) {
 		// choose each row from the top row to the one with the pivot bit
 		for rowCounter := startRow; rowCounter < stopRow; rowCounter++ {
 			// prevent xor with the row itself
-			if rowCounter == pivotBit-startCol {
+			if rowCounter == startRow+pivotBit-startCol {
 				continue
 			}
 
@@ -154,9 +154,9 @@ func (f *F2) PartialGaussianWithLinearChecking(
 			}
 
 			// if the row with a valid pivot bit is not the first row...
-			if pivotBit-startCol != rowCounter {
+			if startRow+pivotBit-startCol != rowCounter {
 				// ...swap it with first one
-				f.SwapRows(pivotBit-startCol, rowCounter)
+				f.SwapRows(startRow+pivotBit-startCol, rowCounter)
 			}
 
 			// iterate through all other rows except the first one
diff --git a/resolver/lineardependency.go b/resolver/lineardependency.go
index cdb96584b13d5f73d7da376aec0acaccbdfe5188..d67b78a7220de40866c02cb2b161dd93ee928869 100644
--- a/resolver/lineardependency.go
+++ b/resolver/lineardependency.go
@@ -45,8 +45,8 @@ func LinearDependenciesInGauss(
 		}
 
 		// remove the 1 with a xor operation with the relating row
-		f.Rows[pivotBit-startCol].Xor(
-			f.Rows[pivotBit-startCol],
+		f.Rows[startRow+pivotBit-startCol].Xor(
+			f.Rows[startRow+pivotBit-startCol],
 			f.Rows[startRow+i-startCol],
 		)
 	}