Fix stupid.
Make log thread safe.
Tweak style.