Thanks for the file. It was a bug - ent_next sometimes returned an entity twice. This will be fixed in the next update.