added thresholdcount in config
graceful error handler