Looking up pages from a multiselect query not working in Kirby 3 upgrade

Hi there,
I’m upgrading a site from Kirby 2 to Kirby 3 and something that previously used to work is now throwing an error…

This is the code in question:

<?php if($featureitem->kind() == 'series'):?>
            <?php foreach($featureitem->series()->pages(',') as $featuredcategory): ?>
            [....some other bits that aren't relevant ....]
                <li class="newssnippet">
                  <a href="<?= $featuredcategory->url() ?>">

The error is “Call to a member function url() on string” on the last line there. $featureitem is a structure and the series() is a multiselect with a query to fetch specific ‘category’ pages and output the page ID.

Does anyone have any clues what the problem might be? It’s obviously not recognising the $featuredcategory as a page but I don’t know how to rectify that?

Thanks very much,
Rach

Don’t worry, I’ve figured it out!

Just swapped ->pages(’,’) for ->toPages(’,’)

Phew!