add error checking to database loading