Adjusted database check code