Previous attempt to fix the deadlock was incorrect. Really fixed the deadlock.