database check logic change