it works better, but still crashes sometimes

it crashes when you call log because of concurrency problems.