changed ManualResetEvent to AutoResetEvent