Hi,
your script seems to work fine.
Nevertheless if you are getting Sync-Keys you have two or more tables with some (not all) equal fieldnames. By default these tables will be linked together using these "common fields".
If all ( ! ) of your input tables have exactly (! ) the same structure they will be automatically appended (concatenated) into one huge table. Having Sync In this case check out your driving table and possible links.
HtH
Roland