bug fix where ids collide between temp and main dbs