improvement to the deadlock detection