Added db function in diagnostic mode