fixed database cleaning issue