create thread stack corruption fix