fix cleanup tool for new db structure