Correct ref around deadlocks