daemon: Fix the most apparent deadlocks