better check of database existence