Index: fact/Evidence/History.cc
===================================================================
--- fact/Evidence/History.cc	(revision 14189)
+++ fact/Evidence/History.cc	(revision 17017)
@@ -31,5 +31,5 @@
 const int MIN_SIZE_KB = 50;					// Min and max buffersize in kByte (> 3*sizeof(int) !)
 const string DEFAULT_MAX_SIZE_KB = "2000";
-const string DEFAULT_NUM_ENTRIES = "1000";	// Number of entries in each history buffer
+const string DEFAULT_NUM_ENTRIES = "1000";		// Number of entries in each history buffer
 const double MIN_SAVE_PERDIOD = 0.5;			// Minimum period between saving history buffers in hours
 
@@ -172,9 +172,8 @@
 
   // Resize buffer if necessary
-  int NEntries = atoi(GetConfig("numentries").c_str());
-  if (Map[Service].Buffer.size() < NEntries*I->getSize()) {
-	if (NEntries*I->getSize() < atoi(GetConfig("maxsize_kb").c_str())*1024) {
-	  Map[Service].Buffer.resize(NEntries*I->getSize());
-	}
+  unsigned long TargetSize = atoi(GetConfig("numentries").c_str()) * I->getSize();
+
+  if (Map[Service].Buffer.size() < TargetSize && TargetSize < atoi(GetConfig("maxsize_kb").c_str())*1024) {
+	  Map[Service].Buffer.resize(TargetSize);
   }
 
