For some reason it did not fetch all 66 products from the all collection - but only apparently the first 48.
Solution was in this case to create a collection with only the needed products (which is less than 48).
However, if anyone would know how to change the script to make it more solid and work with 48+ products, suggestions are welcome.