fix bug where left join was creating entries in agents table for all simids not just the currently being processed simid