I removed the use of the id field as a key. This seemed to cause errors if there were current records in JBS. I also changed the counting of migrated records to a simple addition rather than using getAffectedRows().

needs some more testing.