Yes, that was the problem. I looked at the code again, and I saw that my function made a lot of dummy entities.
Thx for your help.