Avoid NaN

1. Add `divided by 0` check to avoid NaN. It happened when no data is coming yet, but `flush` occured. 
2. Add `rescue => e` so that anomaly detect does not die easily
3. Add $log.debug because it was very useful when I created this patch.