One more dead lock fix.

Thread synchronization is really tricky...