Fix deadlocking issue