fixed memory issue in db-sync