Avoid wrong type problems in corpus stats

Change-Id: Ic1b9aa5e3364ca53e8f7aabf1103c90410037387
diff --git a/R/KorAPCorpusStats.R b/R/KorAPCorpusStats.R
index 655e9b9..575be8a 100644
--- a/R/KorAPCorpusStats.R
+++ b/R/KorAPCorpusStats.R
@@ -62,10 +62,10 @@
       new(
         "KorAPCorpusStats",
         vc = vc,
-        documents = res$documents,
-        tokens = res$tokens,
-        sentences = res$sentences,
-        paragraphs = res$paragraphs,
+        documents = ifelse(is.logical(res$documents), 0, res$documents),
+        tokens = ifelse(is.logical(res$tokens), 0, res$tokens),
+        sentences = ifelse(is.logical(res$documents), 0,res$sentences),
+        paragraphs = ifelse(is.logical(res$paragraphs), 0, res$paragraphs),
         webUIRequestUrl = webUIRequestUrl
       )
   }