added back locking on db operations