Fixing WaitForMultipleObjects