diff --git a/alib2algo/src/stringology/query/SuffixAutomatonFactors.h b/alib2algo/src/stringology/query/SuffixAutomatonFactors.h
index 62a8f2a271d80da35a1c95ba752acf4ec9641870..701ba03190b9a1238b865b8cb59dc025fcffe30b 100644
--- a/alib2algo/src/stringology/query/SuffixAutomatonFactors.h
+++ b/alib2algo/src/stringology/query/SuffixAutomatonFactors.h
@@ -59,7 +59,7 @@ ext::set < unsigned > SuffixAutomatonFactors::query ( const indexes::stringology
 
 	ext::set < unsigned > res;
 	for ( unsigned dist : tmp )
-		res.insert ( backboneLength - dist - 1 );
+		res.insert ( backboneLength - dist - string.getContent ( ).size ( ) );
 
 	return res;
 }