logic change for deadlock detection