It was a bug in the end, I fixed it and made some other changes too:
https://home.stavros.io/polykatamari/