thread deadlock fixed