CriticalSection bug fix.