diff --git a/pdf2htmlEX.1.in b/pdf2htmlEX.1.in
index 74cab5f..ed8c234 100644
--- a/pdf2htmlEX.1.in
+++ b/pdf2htmlEX.1.in
@@ -189,7 +189,9 @@ For some versions of Firefox, however, there will be a problem when the font siz
.TP
.B --space-as-offset <0|1> (Default: 1)
-If set to 1, space characters will be treated as offsets, which allows a better optimization. Turn it off if space characters are not displayed correctly.
+If set to 1, space characters will be treated as offsets, which allows a better optimization.
+
+This option may cause problems for PDF files with bad encodings.
.TP
.B --tounicode <-1|0|1> (Default: 0)
diff --git a/src/HTMLRenderer/TextLineBuffer.cc b/src/HTMLRenderer/TextLineBuffer.cc
index 20b6442..143c039 100644
--- a/src/HTMLRenderer/TextLineBuffer.cc
+++ b/src/HTMLRenderer/TextLineBuffer.cc
@@ -338,7 +338,8 @@ void HTMLRenderer::TextLineBuffer::optimize()
}
// now we would like to adjust letter space to most_used width
- if(max_count <= text_count - offset_count)
+ // we shall apply the optimization only when it can significantly reduce the number of elements
+ if(max_count <= text_count / 2)
{
// the old value is the best
// just copy copy offsets