Change db exist logic