added deadlock checking
added deadlock checking