fix critical delete database bug