Fixed a huge bug in the import script.

Whenever you would query entities and get 500n+1 records, you would
only get 1 record!