Fixed a very rarely seen deadlock.
Now I'm fighting another one. Wish me luck.