adding check if table exists in database