added in some checking while collecting database info