WIP: deadlock fixes