fixed database crash issue