Basic error checking while reading database