Fix infinite loop with get stats RPC from doc list