fixed bug with AutoResetEvent

AutoResetEvent,WaitOne() was passed by though it should've waited.