Another attempt to fix deadlock