Fixing some deadlocks.