Fix deadlock