Fixes deadlock