added critical section for file logging