bugfix in the db delete function