improve log perf, save less often, fix KEYS bug