checking for nil db