Fix bug middleware dynamic sites