database check first