Fix deadlock in listen command.