improve sentry middleware for book