some database error handling