rework db_deletekey to fix problems