Fixed database error reporting