fixed missing objid bug and added transaction to db for speed