added a slight amount of error reporting in database