diff --git a/fasthtml/core.py b/fasthtml/core.py
index 91476828..e7a03642 100644
--- a/fasthtml/core.py
+++ b/fasthtml/core.py
@@ -547,7 +547,7 @@ def __init__(self, debug=False, routes=None, middleware=None, exception_handlers
def _not_found(req, exc): return Response('404 Not Found', status_code=404)
exception_handlers[404] = _not_found
excs = {k:_wrap_ex(v, hdrs, ftrs, htmlkw, bodykw) for k,v in exception_handlers.items()}
- super().__init__(debug, routes, middleware, excs, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan)
+ super().__init__(debug, routes, middleware=middleware, exception_handlers=excs, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan)
self.router = RouterX(self, routes)
def ws(self, path:str, conn=None, disconn=None, name=None):
diff --git a/nbs/api/00_core.ipynb b/nbs/api/00_core.ipynb
index 8a5eb275..cebd7df0 100644
--- a/nbs/api/00_core.ipynb
+++ b/nbs/api/00_core.ipynb
@@ -1402,7 +1402,7 @@
" def _not_found(req, exc): return Response('404 Not Found', status_code=404) \n",
" exception_handlers[404] = _not_found\n",
" excs = {k:_wrap_ex(v, hdrs, ftrs, htmlkw, bodykw) for k,v in exception_handlers.items()}\n",
- " super().__init__(debug, routes, middleware, excs, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan)\n",
+ " super().__init__(debug, routes, middleware=middleware, exception_handlers=excs, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan)\n",
" self.router = RouterX(self, routes)\n",
"\n",
" def ws(self, path:str, conn=None, disconn=None, name=None):\n",