copy loop problem in nav 2018 report

I have tried to run the standard NAV purchase order report 405 in a NAV 2018 database. It falls over in the copy loop data item with this line of code

SETRANGE(Number,1,NoOfLoops); NoOfLoops evaluates to 1 in this case

This causes an 'out of memory' error and Nav closes

If I comment out this code and the other places where there is a similar filter set (e.g. SETRANGE(Number,1,PurchLine.COUNT in the round loop data item) then the report runs.

I have found the same problem with other (standard) reports that have similar filter lines

I have run the same report in a different client (same version of nav 2018) it runs without problem.

Any explanations most welcome!